|
|
|
@ -149,6 +149,7 @@ public class MongoTemplateTests { |
|
|
|
template.dropCollection(Sample.class); |
|
|
|
template.dropCollection(Sample.class); |
|
|
|
template.dropCollection(MyPerson.class); |
|
|
|
template.dropCollection(MyPerson.class); |
|
|
|
template.dropCollection(TypeWithFieldAnnotation.class); |
|
|
|
template.dropCollection(TypeWithFieldAnnotation.class); |
|
|
|
|
|
|
|
template.dropCollection(TypeWithDate.class); |
|
|
|
template.dropCollection("collection"); |
|
|
|
template.dropCollection("collection"); |
|
|
|
template.dropCollection("personX"); |
|
|
|
template.dropCollection("personX"); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1642,6 +1643,24 @@ public class MongoTemplateTests { |
|
|
|
assertThat(result.emailAddress, is("new")); |
|
|
|
assertThat(result.emailAddress, is("new")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @see DATAMONGO-671 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void findsEntityByDateReference() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TypeWithDate entity = new TypeWithDate(); |
|
|
|
|
|
|
|
entity.date = new Date(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template.save(entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Query query = query(where("date").lt(new Date())); |
|
|
|
|
|
|
|
List<TypeWithDate> result = template.find(query, TypeWithDate.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(result, hasSize(1)); |
|
|
|
|
|
|
|
assertThat(result.get(0).date, is(notNullValue())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static class MyId { |
|
|
|
static class MyId { |
|
|
|
|
|
|
|
|
|
|
|
String first; |
|
|
|
String first; |
|
|
|
@ -1721,4 +1740,10 @@ public class MongoTemplateTests { |
|
|
|
@Id ObjectId id; |
|
|
|
@Id ObjectId id; |
|
|
|
@Field("email") String emailAddress; |
|
|
|
@Field("email") String emailAddress; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static class TypeWithDate { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Id String id; |
|
|
|
|
|
|
|
Date date; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|