Skip to content

Commit

Permalink
SERVER-1883 in or de duping, correctly retrieve nested field for matc…
Browse files Browse the repository at this point in the history
…h document
  • Loading branch information
astaple committed Oct 12, 2010
1 parent 136024a commit 6f0c76a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/queryutil.cpp
Expand Up @@ -982,7 +982,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();
}
Expand Down
7 changes: 7 additions & 0 deletions jstests/or8.js
Expand Up @@ -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 6f0c76a

Please sign in to comment.