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