@@ -1084,6 +1084,73 @@ void rendersQueryOnNestedPrefixedEmbeddedCorrectly() {
1084
1084
assertThat (target ).isEqualTo (new org .bson .Document ("withPrefixedEmbedded.prefix-stringValue" , "test" ));
1085
1085
}
1086
1086
1087
+ @ Test // DATAMONGO-1902
1088
+ void sortByEmbeddable () {
1089
+
1090
+ Query query = new Query ().with (Sort .by ("embeddableValue" ));
1091
+
1092
+ org .bson .Document document = mapper .getMappedSort (query .getSortObject (),
1093
+ context .getPersistentEntity (WithEmbedded .class ));
1094
+
1095
+ assertThat (document ).isEqualTo (new org .bson .Document ());
1096
+ }
1097
+
1098
+ @ Test // DATAMONGO-1902
1099
+ void sortByEmbeddableValue () {
1100
+
1101
+ // atFieldAnnotatedValue
1102
+ Query query = new Query ().with (Sort .by ("embeddableValue.stringValue" ));
1103
+
1104
+ org .bson .Document document = mapper .getMappedSort (query .getSortObject (),
1105
+ context .getPersistentEntity (WithEmbedded .class ));
1106
+
1107
+ assertThat (document ).isEqualTo (new org .bson .Document ("stringValue" , 1 ));
1108
+ }
1109
+
1110
+ @ Test // DATAMONGO-1902
1111
+ void sortByEmbeddableValueWithFieldAnnotation () {
1112
+
1113
+ Query query = new Query ().with (Sort .by ("embeddableValue.atFieldAnnotatedValue" ));
1114
+
1115
+ org .bson .Document document = mapper .getMappedSort (query .getSortObject (),
1116
+ context .getPersistentEntity (WithEmbedded .class ));
1117
+
1118
+ assertThat (document ).isEqualTo (new org .bson .Document ("with-at-field-annotation" , 1 ));
1119
+ }
1120
+
1121
+ @ Test // DATAMONGO-1902
1122
+ void sortByPrefixedEmbeddableValueWithFieldAnnotation () {
1123
+
1124
+ Query query = new Query ().with (Sort .by ("embeddableValue.atFieldAnnotatedValue" ));
1125
+
1126
+ org .bson .Document document = mapper .getMappedSort (query .getSortObject (),
1127
+ context .getPersistentEntity (WithPrefixedEmbedded .class ));
1128
+
1129
+ assertThat (document ).isEqualTo (new org .bson .Document ("prefix-with-at-field-annotation" , 1 ));
1130
+ }
1131
+
1132
+ @ Test // DATAMONGO-1902
1133
+ void sortByNestedEmbeddableValueWithFieldAnnotation () {
1134
+
1135
+ Query query = new Query ().with (Sort .by ("withEmbedded.embeddableValue.atFieldAnnotatedValue" ));
1136
+
1137
+ org .bson .Document document = mapper .getMappedSort (query .getSortObject (),
1138
+ context .getPersistentEntity (WrapperAroundWithEmbedded .class ));
1139
+
1140
+ assertThat (document ).isEqualTo (new org .bson .Document ("withEmbedded.with-at-field-annotation" , 1 ));
1141
+ }
1142
+
1143
+ @ Test // DATAMONGO-1902
1144
+ void sortByNestedPrefixedEmbeddableValueWithFieldAnnotation () {
1145
+
1146
+ Query query = new Query ().with (Sort .by ("withPrefixedEmbedded.embeddableValue.atFieldAnnotatedValue" ));
1147
+
1148
+ org .bson .Document document = mapper .getMappedSort (query .getSortObject (),
1149
+ context .getPersistentEntity (WrapperAroundWithEmbedded .class ));
1150
+
1151
+ assertThat (document ).isEqualTo (new org .bson .Document ("withPrefixedEmbedded.prefix-with-at-field-annotation" , 1 ));
1152
+ }
1153
+
1087
1154
class WithDeepArrayNesting {
1088
1155
1089
1156
List <WithNestedArray > level0 ;
0 commit comments