DBObject getProjection() { return options.getProjection(); }
operation = new FindAndDeleteOperation<DBObject>(getNamespace(), writeConcern, retryWrites, objectCodec) .filter(wrapAllowNull(query)) .projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) wrap(update)) .filter(wrap(query)) .projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew()) wrap(update)) .filter(wrap(query)) .projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew())
@Test public void passThrough() { Collation collation = Collation.builder() .locale("en") .caseLevel(true) .build(); DBCollectionFindAndModifyOptions options = new FindAndModifyOptions() .bypassDocumentValidation(true) .collation(collation).getOptions() .maxTime(15, TimeUnit.MINUTES) .projection(new BasicDBObject("field", "value")) .remove(true) .returnNew(true) .sort(new BasicDBObject("field", -1)) .update(new BasicDBObject("$inc", "somefield")) .upsert(true) .writeConcern(WriteConcern.JOURNALED); assertTrue(options.getBypassDocumentValidation()); assertEquals(collation, options.getCollation()); assertEquals(15, options.getMaxTime(TimeUnit.MINUTES)); assertEquals(new BasicDBObject("field", "value"), options.getProjection()); assertTrue(options.isRemove()); assertTrue(options.returnNew()); assertEquals(new BasicDBObject("field", -1), options.getSort()); assertEquals(new BasicDBObject("$inc", "somefield"), options.getUpdate()); assertTrue(options.isUpsert()); assertEquals(WriteConcern.JOURNALED, options.getWriteConcern()); } }
DBObject getProjection() { return options.getProjection(); }
operation = new FindAndDeleteOperation<DBObject>(getNamespace(), writeConcern, retryWrites, objectCodec) .filter(wrapAllowNull(query)) .projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) wrap(update)) .filter(wrap(query)) .projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew()) wrap(update)) .filter(wrap(query)) .projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew())