List of usage examples for com.mongodb DBCollection findAndModify
@Nullable public DBObject findAndModify(@Nullable final DBObject query, @Nullable final DBObject sort, final DBObject update)
From source file:com.norconex.collector.http.data.store.impl.mongo.MongoCrawlDataSerializer.java
License:Apache License
@Override public DBObject getNextQueued(DBCollection collRefs) { BasicDBObject whereQuery = new BasicDBObject(FIELD_STAGE, Stage.QUEUED.name()); BasicDBObject sort = new BasicDBObject(FIELD_DEPTH, 1); BasicDBObject newDocument = new BasicDBObject("$set", new BasicDBObject(FIELD_STAGE, Stage.ACTIVE.name())); return collRefs.findAndModify(whereQuery, sort, newDocument); }