/** * Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time. * * @param timeUnit the time unit to return the result in * @return the maximum execution time in the given time unit * @mongodb.driver.manual reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time */ public long getMaxTime(final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); return options.getMaxTime(timeUnit); }
.projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .collation(options.getCollation()); } else { .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation()) .collation(options.getCollation()) .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation()) .collation(options.getCollation());
@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()); } }
/** * Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time. * * @param timeUnit the time unit to return the result in * @return the maximum execution time in the given time unit * @mongodb.driver.manual reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time */ public long getMaxTime(final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); return options.getMaxTime(timeUnit); }
.projection(wrapAllowNull(options.getProjection())) .sort(wrapAllowNull(options.getSort())) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .collation(options.getCollation()); } else { .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation()) .collation(options.getCollation()) .returnOriginal(!options.returnNew()) .upsert(options.isUpsert()) .maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS) .bypassDocumentValidation(options.getBypassDocumentValidation()) .collation(options.getCollation());