Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SERVER-1883 in or de duping, correctly retrieve nested field for matc…

…h document
  • Loading branch information...
commit d3b2dddd7400f0efec97e3d5913847ee5c5a20a0 1 parent 75351ec
@astaple astaple authored
Showing with 8 additions and 1 deletion.
  1. +1 −1  db/queryutil.cpp
  2. +7 −0 jstests/or8.js
View
2  db/queryutil.cpp
@@ -1029,7 +1029,7 @@ namespace mongo {
BSONElement kk = k.next();
int number = (int) kk.number();
bool forward = ( number >= 0 ? 1 : -1 ) * ( _direction >= 0 ? 1 : -1 ) > 0;
- BSONElement e = obj.getField( kk.fieldName() );
+ BSONElement e = obj.getFieldDotted( kk.fieldName() );
if ( e.eoo() ) {
e = staticNull.firstElement();
}
View
7 jstests/or8.js
@@ -14,3 +14,10 @@ t.find({ $or: [ { a: {$in:[]} } ] } ).toArray();
assert.eq.automsg( "2", "t.find({ $or: [ { a: {$in:[]} }, {a:1}, {a:3} ] } ).toArray().length" );
assert.eq.automsg( "2", "t.find({ $or: [ {a:1}, { a: {$in:[]} }, {a:3} ] } ).toArray().length" );
assert.eq.automsg( "2", "t.find({ $or: [ {a:1}, {a:3}, { a: {$in:[]} } ] } ).toArray().length" );
+
+// nested negate field
+
+t.drop();
+t.save( {a:{b:1,c:1}} );
+t.ensureIndex( { 'a.b':1, 'a.c':1 } );
+assert.eq( 1, t.find( {$or: [ { 'a.b':1 }, { 'a.c':1 } ] } ).itcount() );
Please sign in to comment.
Something went wrong with that request. Please try again.