File tree 1 file changed +25
-0
lines changed
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ protected void cleanDb() {
149
149
template .dropCollection (Sample .class );
150
150
template .dropCollection (MyPerson .class );
151
151
template .dropCollection (TypeWithFieldAnnotation .class );
152
+ template .dropCollection (TypeWithDate .class );
152
153
template .dropCollection ("collection" );
153
154
template .dropCollection ("personX" );
154
155
}
@@ -1642,6 +1643,24 @@ public void updateConsidersMappingAnnotations() {
1642
1643
assertThat (result .emailAddress , is ("new" ));
1643
1644
}
1644
1645
1646
+ /**
1647
+ * @see DATAMONGO-671
1648
+ */
1649
+ @ Test
1650
+ public void findsEntityByDateReference () {
1651
+
1652
+ TypeWithDate entity = new TypeWithDate ();
1653
+ entity .date = new Date ();
1654
+
1655
+ template .save (entity );
1656
+
1657
+ Query query = query (where ("date" ).lt (new Date ()));
1658
+ List <TypeWithDate > result = template .find (query , TypeWithDate .class );
1659
+
1660
+ assertThat (result , hasSize (1 ));
1661
+ assertThat (result .get (0 ).date , is (notNullValue ()));
1662
+ }
1663
+
1645
1664
static class MyId {
1646
1665
1647
1666
String first ;
@@ -1721,4 +1740,10 @@ static class TypeWithFieldAnnotation {
1721
1740
@ Id ObjectId id ;
1722
1741
@ Field ("email" ) String emailAddress ;
1723
1742
}
1743
+
1744
+ static class TypeWithDate {
1745
+
1746
+ @ Id String id ;
1747
+ Date date ;
1748
+ }
1724
1749
}
You can’t perform that action at this time.
0 commit comments