Package com.mongodb

Examples of com.mongodb.DBCollection.find()


                .and(CommitMongo.KEY_REVISION_ID).lessThanEquals(MongoUtil.toMongoRepresentation(toRevisionId))
                .get();

        LOG.debug(String.format("Executing query: %s", query));

        return commitCollection.find(query).limit(maxEntries);
    }
}
View Full Code Here


        DBObject query = QueryBuilder.start(NodeMongo.KEY_PATH).in(paths).and(NodeMongo.KEY_REVISION_ID)
                .lessThanEquals(MongoUtil.toMongoRepresentation(revisionId)).get();

        LOG.debug(String.format("Executing query: %s", query));

        DBCursor dbCursor = nodeCollection.find(query);

        return dbCursor;
    }
}
View Full Code Here

        EasyMock.expect(mockDbCursor.next()).andReturn(secondCommit).once();
        EasyMock.expect(mockDbCursor.hasNext()).andReturn(false).once();
        EasyMock.replay(mockDbCursor);

        DBCollection mockCommitCollection = EasyMock.createMock(DBCollection.class);
        EasyMock.expect(mockCommitCollection.find(EasyMock.anyObject(DBObject.class))).andReturn(mockDbCursor);
        EasyMock.replay(mockCommitCollection);

        MongoConnection mockConnection = EasyMock.createMock(MongoConnection.class);
        EasyMock.expect(mockConnection.getNodeCollection()).andReturn(mockNodeCollection).times(2);
        EasyMock.expect(mockConnection.getCommitCollection()).andReturn(mockCommitCollection);
View Full Code Here

        DBObject query = qb.get();

        LOG.debug(String.format("Executing query: %s", query));

        DBCursor dbCursor = nodeCollection.find(query);

        return dbCursor;
    }
}
View Full Code Here

        EasyMock.expect(mockDbCursor.next()).andReturn(secondCommit).once();
        EasyMock.expect(mockDbCursor.hasNext()).andReturn(false).once();
        EasyMock.replay(mockDbCursor);

        DBCollection mockCommitCollection = EasyMock.createMock(DBCollection.class);
        EasyMock.expect(mockCommitCollection.find(EasyMock.anyObject(DBObject.class))).andReturn(mockDbCursor);
        EasyMock.replay(mockCommitCollection);

        MongoConnection mockConnection = EasyMock.createMock(MongoConnection.class);
        EasyMock.expect(mockConnection.getNodeCollection()).andReturn(mockNodeCollection).times(2);
        EasyMock.expect(mockConnection.getCommitCollection()).andReturn(mockCommitCollection);
View Full Code Here

    }

    @Override
    public Iterator<StateReader> instancesOf(final String specificationName) {
        final DBCollection instances = db.getCollection(specificationName);
        final DBCursor cursor = instances.find();
        LOG.info("searching for instances of: " + specificationName);
        return new Iterator<StateReader>() {
            @Override
            public boolean hasNext() {
                return cursor.hasNext();
View Full Code Here

            if (this.lastHeadRevId < headMongo.getHeadRevisionId()) {
                DBCollection commitCollection = this.mongoConnection.getCommitCollection();
                DBObject query = QueryBuilder.start(CommitMongo.KEY_REVISION_ID).greaterThan(this.lastRevId)
                        .and(CommitMongo.KEY_REVISION_ID).lessThanEquals(headMongo.getHeadRevisionId()).get();
                DBObject sort = QueryBuilder.start(CommitMongo.KEY_REVISION_ID).is(1).get();
                DBCursor dbCursor = commitCollection.find(query).sort(sort);
                while (dbCursor.hasNext()) {
                    commitMongos.add((CommitMongo) dbCursor.next());
                }

                if (commitMongos.size() > 0) {
View Full Code Here

        BasicDBObject filter = new BasicDBObject().append("targetId", range.getTargetID()).append("logId", range.getStoreID());
        if (high > 0) {
            filter.append("id", new BasicDBObject("$lte", high));
        }

        DBCursor cursor = collection.find(filter);
        cursor.sort(new BasicDBObject("id", 1));

        List<Event> Events = new ArrayList<Event>();
        while (cursor.hasNext()) {
            DBObject event = cursor.next();
View Full Code Here

        DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);

        BasicDBObject filter = new BasicDBObject().append("targetId", targetID)
            .append("logId", logID);

        DBCursor cursor = collection.find(filter);
        cursor.sort(new BasicDBObject("id", -1));

        long high = 1;
        if (cursor.hasNext()) {
            DBObject row = cursor.next();
View Full Code Here

        BasicDBObject query = new BasicDBObject();
        DBCursor cursor;

        query.put("connection.$id", connectionId);

        cursor = collection.find(query);

        List<InventoryItem> inventoryItems = new ArrayList<>();

        try {
            while (cursor.hasNext()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.