/** * Returns the upsert * * @return the upsert */ public boolean isUpsert() { return options.isUpsert(); }
@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()); } }
.sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation()) .sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation())
/** * Returns the upsert * * @return the upsert */ public boolean isUpsert() { return options.isUpsert(); }
.sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation()) .sort(wrapAllowNull(options.getSort())) .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation())