File tree 2 files changed +12
-1
lines changed
main/java/org/springframework/data/mongodb/core/aggregation
test/java/org/springframework/data/mongodb/core/aggregation
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ public String getName() {
255
255
256
256
public String getTarget () {
257
257
258
- if (isLocalVar ()) {
258
+ if (isLocalVar () || pointsToDBRefId () ) {
259
259
return this .getRaw ();
260
260
}
261
261
@@ -280,6 +280,10 @@ public boolean isLocalVar() {
280
280
return raw .startsWith ("$$" ) && !raw .startsWith ("$$$" );
281
281
}
282
282
283
+ protected boolean pointsToDBRefId () { // see https://jira.mongodb.org/browse/SERVER-14466
284
+ return raw .endsWith (".$id" );
285
+ }
286
+
283
287
/**
284
288
* @return
285
289
* @since 1.10
Original file line number Diff line number Diff line change @@ -117,6 +117,13 @@ public void stripsLeadingDollarsFromTarget() {
117
117
assertThat (Fields .field ("$$$$target" ).getTarget ()).isEqualTo ("target" );
118
118
}
119
119
120
+ @ Test // GH-4123
121
+ public void keepsRawMappingToDbRefId () {
122
+
123
+ assertThat (Fields .field ("$id" ).getName ()).isEqualTo ("id" );
124
+ assertThat (Fields .field ("person.$id" ).getTarget ()).isEqualTo ("person.$id" );
125
+ }
126
+
120
127
private static void verify (Field field , String name , String target ) {
121
128
122
129
assertThat (field ).isNotNull ();
You can’t perform that action at this time.
0 commit comments