use of dev.morphia.query.FindAndDeleteOptions in project morphia by mongodb.
the class TestDatastore method testFindAndDeleteWithCollation.
@Test
public void testFindAndDeleteWithCollation() {
getDs().save(asList(new FacebookUser(1, "John Doe"), new FacebookUser(2, "john doe")));
Query<FacebookUser> query = getDs().find(FacebookUser.class).filter(eq("username", "john doe"));
assertNotNull(query.findAndDelete());
assertNull(query.findAndDelete());
FindAndDeleteOptions options = new FindAndDeleteOptions().collation(Collation.builder().locale("en").collationStrength(SECONDARY).build());
assertNotNull(query.findAndDelete(options));
assertNull(query.iterator().tryNext());
}
Aggregations