diff options
author | Eliot Horowitz <eliot@10gen.com> | 2013-05-19 11:14:00 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2013-05-19 11:14:00 -0400 |
commit | f6fb00300c6994fbe79adfbd1b8a0a6cbe44710b (patch) | |
tree | 550f20d4c9ec1003190e37bb4e2d95c0bf49023c | |
parent | b15928f4a371b9804cfb419dc64c46677c6c5900 (diff) | |
download | mongo-f6fb00300c6994fbe79adfbd1b8a0a6cbe44710b.tar.gz |
SERVER-6400: fix $or use of indexes
-rw-r--r-- | src/mongo/db/matcher/matcher.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/matcher/matcher.cpp b/src/mongo/db/matcher/matcher.cpp index 42bb4b3357e..ea9a3b6885a 100644 --- a/src/mongo/db/matcher/matcher.cpp +++ b/src/mongo/db/matcher/matcher.cpp @@ -272,6 +272,8 @@ namespace mongo { return NULL; case MatchExpression::OR: + + case MatchExpression::AND: { auto_ptr<ListOfMatchExpression> dup; for ( unsigned i = 0; i < full->numChildren(); i++ ) { @@ -286,8 +288,14 @@ namespace mongo { } dup->add( sub ); } - if ( dup.get() ) + if ( dup.get() ) { + if ( full->matchType() == MatchExpression::OR && + dup->numChildren() != full->numChildren() ) { + // with an $or, have to make sure its all or nothing + return NULL; + } return dup.release(); + } return NULL; } |