diff options
Diffstat (limited to 'db/queryutil.cpp')
-rw-r--r-- | db/queryutil.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/db/queryutil.cpp b/db/queryutil.cpp index 007a1ce..2153046 100644 --- a/db/queryutil.cpp +++ b/db/queryutil.cpp @@ -982,23 +982,16 @@ 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() ); - if ( e.eoo() ) { - e = staticNull.firstElement(); - } - if ( e.type() == Array ) { - BSONObjIterator j( e.embeddedObject() ); - bool match = false; - while( j.more() ) { - if ( matchesElement( j.next(), i, forward ) ) { - match = true; - break; - } - } - if ( !match ) { - return false; + BSONElementSet keys; + obj.getFieldsDotted( kk.fieldName(), keys ); + bool match = false; + for( BSONElementSet::const_iterator j = keys.begin(); j != keys.end(); ++j ) { + if ( matchesElement( *j, i, forward ) ) { + match = true; + break; } - } else if ( !matchesElement( e, i, forward ) ) { + } + if ( !match ) { return false; } } |