summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-10-02 12:25:35 -0700
committerAaron <aaron@10gen.com>2010-10-11 23:49:10 -0700
commit6f0c76a552e60f2768796f61e55088dfda66784d (patch)
tree1823dfd351cee66e61ed451aa9b464e26d48a237
parent136024a59fcaf2044d8b95c1a77437bd1f01f908 (diff)
downloadmongo-6f0c76a552e60f2768796f61e55088dfda66784d.tar.gz
SERVER-1883 in or de duping, correctly retrieve nested field for match document
-rw-r--r--db/queryutil.cpp2
-rw-r--r--jstests/or8.js7
2 files changed, 8 insertions, 1 deletions
diff --git a/db/queryutil.cpp b/db/queryutil.cpp
index 007a1ce6e6f..ad083e5d739 100644
--- a/db/queryutil.cpp
+++ b/db/queryutil.cpp
@@ -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();
}
diff --git a/jstests/or8.js b/jstests/or8.js
index 7a5c709e3c6..3cf9d26de5b 100644
--- a/jstests/or8.js
+++ b/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() ); \ No newline at end of file