@Test public void testFindAndDeleteWithNoQueryMatch() { assertNull(getDs().findAndDelete(getDs() .find(FacebookUser.class) .field("username").equal("David S. Pumpkins"))); }
@Test public void testFindAndDeleteWithCollation() { checkMinServerVersion(3.4); getDs().getCollection(FacebookUser.class).drop(); getDs().save(asList(new FacebookUser(1, "John Doe"), new FacebookUser(2, "john doe"))); Query<FacebookUser> query = getDs().find(FacebookUser.class) .field("username").equal("john doe"); assertNotNull(getDs().findAndDelete(query)); assertNull(getDs().findAndDelete(query)); FindAndModifyOptions options = new FindAndModifyOptions() .collation(Collation.builder() .locale("en") .collationStrength(CollationStrength.SECONDARY) .build()); assertNotNull(getDs().findAndDelete(query, options)); assertTrue("Options should not be modified by the datastore", options.isReturnNew()); assertFalse("Options should not be modified by the datastore", options.isRemove()); }