From aef493fdb87a47afeb16cf58b48f22e69da22a63 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Thu, 13 Sep 2012 17:24:27 +0200 Subject: [PATCH] DATAMONGO-539 - Added test case to show removing entity from explicit collection works. --- .../data/mongodb/core/MongoTemplateTests.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java index 293529c12..64d4ea31b 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java @@ -1226,6 +1226,23 @@ public class MongoTemplateTests { template.remove(query(where("id").is(id)), TypeWithMyId.class); } + /** + * @see DATAMONGO-539 + */ + @Test + public void removesObjectFromExplicitCollection() { + + String collectionName = "explicit"; + template.remove(new Query(), collectionName); + + Person person = new Person("Dave"); + template.save(person, collectionName); + assertThat(template.findAll(Person.class, collectionName).isEmpty(), is(false)); + + template.remove(person, collectionName); + assertThat(template.findAll(Person.class, collectionName).isEmpty(), is(true)); + } + static class MyId { String first;