Permalink
Browse files

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

…h document
  • Loading branch information...
1 parent 75351ec commit d3b2dddd7400f0efec97e3d5913847ee5c5a20a0 @astaple astaple committed Oct 2, 2010
Showing with 8 additions and 1 deletion.
  1. +1 −1 db/queryutil.cpp
  2. +7 −0 jstests/or8.js
View
@@ -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
@@ -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() );

0 comments on commit d3b2ddd

Please sign in to comment.