use of dev.morphia.query.CountOptions in project morphia by mongodb.
the class TestLegacyQuery method testCollations.
@Test
public void testCollations() {
getMapper().map(ContainsRenamedFields.class);
getDs().save(asList(new ContainsRenamedFields("first", "last"), new ContainsRenamedFields("First", "Last")));
Query query = getDs().find(ContainsRenamedFields.class).field("last_name").equal("last");
assertEquals(query.execute().toList().size(), 1);
assertEquals(query.execute(new FindOptions().collation(builder().locale("en").collationStrength(CollationStrength.SECONDARY).build())).toList().size(), 2);
assertEquals(query.count(), 1);
assertEquals(query.count(new CountOptions().collation(builder().locale("en").collationStrength(CollationStrength.SECONDARY).build())), 2);
}
use of dev.morphia.query.CountOptions in project morphia by mongodb.
the class TestQuery method testCollations.
@Test
public void testCollations() {
getMapper().map(ContainsRenamedFields.class);
getDs().save(asList(new ContainsRenamedFields("first", "last"), new ContainsRenamedFields("First", "Last")));
Query query = getDs().find(ContainsRenamedFields.class).filter(eq("last_name", "last"));
assertEquals(query.iterator().toList().size(), 1);
assertEquals(query.iterator(new FindOptions().collation(builder().locale("en").collationStrength(CollationStrength.SECONDARY).build())).toList().size(), 2);
assertEquals(query.count(), 1);
assertEquals(query.count(new CountOptions().collation(builder().locale("en").collationStrength(CollationStrength.SECONDARY).build())), 2);
}
Aggregations