summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2013-05-19 11:14:00 -0400
committerEliot Horowitz <eliot@10gen.com>2013-05-19 11:14:00 -0400
commitf6fb00300c6994fbe79adfbd1b8a0a6cbe44710b (patch)
tree550f20d4c9ec1003190e37bb4e2d95c0bf49023c
parentb15928f4a371b9804cfb419dc64c46677c6c5900 (diff)
downloadmongo-f6fb00300c6994fbe79adfbd1b8a0a6cbe44710b.tar.gz
SERVER-6400: fix $or use of indexes
-rw-r--r--src/mongo/db/matcher/matcher.cpp10
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;
}