File tree 1 file changed +14
-1
lines changed
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 23
23
import java .util .Iterator ;
24
24
import java .util .LinkedHashMap ;
25
25
import java .util .List ;
26
+ import java .util .Map ;
26
27
import java .util .Map .Entry ;
27
28
import java .util .regex .Pattern ;
28
29
import java .util .stream .Collectors ;
@@ -997,8 +998,20 @@ private boolean isEqual(Object left, Object right) {
997
998
}
998
999
Document leftDocument = (Document ) left ;
999
1000
Document rightDocument = (Document ) right ;
1001
+ Iterator leftIterator = leftDocument .entrySet ().iterator ();
1002
+ Iterator rightIterator = rightDocument .entrySet ().iterator ();
1000
1003
1001
- return isEqual (leftDocument .values (), rightDocument .values ());
1004
+ while (leftIterator .hasNext () && rightIterator .hasNext ()) {
1005
+ Map .Entry leftEntry = (Map .Entry )leftIterator .next ();
1006
+ Map .Entry rightEntry = (Map .Entry )rightIterator .next ();
1007
+ if (!isEqual (leftEntry .getKey (), rightEntry .getKey ())) {
1008
+ return false ;
1009
+ }
1010
+ if (!isEqual (leftEntry .getValue (), rightEntry .getValue ())) {
1011
+ return false ;
1012
+ }
1013
+ }
1014
+ return !leftIterator .hasNext () && !rightIterator .hasNext ();
1002
1015
}
1003
1016
1004
1017
if (Collection .class .isAssignableFrom (left .getClass ())) {
You can’t perform that action at this time.
0 commit comments