use of com.mongodb.client.model.DBCollectionFindAndModifyOptions in project morphia by mongodb.
the class FindAndModifyOptionsTest method passThrough.
@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());
}
Aggregations