use of com.mongodb.client.model.Collation in project mongo-java-driver by mongodb.
the class OperationHelper method validateWriteRequestCollations.
static void validateWriteRequestCollations(final AsyncConnection connection, final List<? extends WriteRequest> requests, final WriteConcern writeConcern, final AsyncCallableWithConnection callable) {
Collation collation = null;
for (WriteRequest request : requests) {
if (request instanceof UpdateRequest) {
collation = ((UpdateRequest) request).getCollation();
} else if (request instanceof DeleteRequest) {
collation = ((DeleteRequest) request).getCollation();
}
if (collation != null) {
break;
}
}
validateCollationAndWriteConcern(connection, collation, writeConcern, new AsyncCallableWithConnection() {
@Override
public void call(final AsyncConnection connection, final Throwable t) {
callable.call(connection, t);
}
});
}
use of com.mongodb.client.model.Collation in project mongo-java-driver by mongodb.
the class OperationHelper method validateWriteRequestCollations.
static void validateWriteRequestCollations(final Connection connection, final List<? extends WriteRequest> requests, final WriteConcern writeConcern) {
Collation collation = null;
for (WriteRequest request : requests) {
if (request instanceof UpdateRequest) {
collation = ((UpdateRequest) request).getCollation();
} else if (request instanceof DeleteRequest) {
collation = ((DeleteRequest) request).getCollation();
}
if (collation != null) {
break;
}
}
validateCollationAndWriteConcern(connection, collation, writeConcern);
}
use of com.mongodb.client.model.Collation in project morphia by mongodb.
the class FindOptionsTest method passThrough.
@Test
public void passThrough() {
Collation collation = Collation.builder().locale("en").caseLevel(true).build();
DBCollectionFindOptions options = new FindOptions().batchSize(42).limit(18).modifier("i'm a", "modifier").modifier("i am", 2).projection(new BasicDBObject("field", "value")).maxTime(15, TimeUnit.MINUTES).maxAwaitTime(45, TimeUnit.SECONDS).skip(12).sort(new BasicDBObject("field", -1)).cursorType(CursorType.TailableAwait).noCursorTimeout(true).oplogReplay(true).partial(true).readPreference(ReadPreference.secondaryPreferred(2, TimeUnit.MINUTES)).readConcern(ReadConcern.LOCAL).collation(collation).getOptions();
assertEquals(42, options.getBatchSize());
assertEquals(18, options.getLimit());
assertEquals(new BasicDBObject("i'm a", "modifier").append("i am", 2), options.getModifiers());
assertEquals(new BasicDBObject("field", "value"), options.getProjection());
assertEquals(15, options.getMaxTime(TimeUnit.MINUTES));
assertEquals(45, options.getMaxAwaitTime(TimeUnit.SECONDS));
assertEquals(12, options.getSkip());
assertEquals(new BasicDBObject("field", -1), options.getSort());
assertEquals(CursorType.TailableAwait, options.getCursorType());
assertTrue(options.isNoCursorTimeout());
assertTrue(options.isOplogReplay());
assertTrue(options.isPartial());
assertEquals(ReadPreference.secondaryPreferred(2, TimeUnit.MINUTES), options.getReadPreference());
assertEquals(ReadConcern.LOCAL, options.getReadConcern());
assertEquals(collation, options.getCollation());
}
Aggregations