diff options
author | Aaron <aaron@10gen.com> | 2010-06-15 12:29:27 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-06-15 12:29:27 -0700 |
commit | 0715c4db07354dffa7c08b0c2269b1fae5517684 (patch) | |
tree | a1c6ac8c1dbf5ff0e41be1abdd233065d5a36993 | |
parent | 0676284bb13c252782c3f6a9343c6e4140ca799e (diff) | |
download | mongo-0715c4db07354dffa7c08b0c2269b1fae5517684.tar.gz |
SERVER-1242 check nsdetails before using
-rw-r--r-- | db/queryoptimizer.cpp | 8 | ||||
-rw-r--r-- | jstests/or8.js | 6 | ||||
-rw-r--r-- | mongo.xcodeproj/project.pbxproj | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/db/queryoptimizer.cpp b/db/queryoptimizer.cpp index d5d755bf879..cf2ff0f962f 100644 --- a/db/queryoptimizer.cpp +++ b/db/queryoptimizer.cpp @@ -651,9 +651,13 @@ namespace mongo { } bool MultiPlanScanner::uselessOr( const BSONElement &hint ) const { + NamespaceDetails *nsd = nsdetails( _ns ); + if ( !nsd ) { + return true; + } IndexDetails *id = 0; if ( !hint.eoo() ) { - IndexDetails *id = parseHint( hint, nsdetails( _ns ) ); + IndexDetails *id = parseHint( hint, nsd ); if ( !id ) { return true; } @@ -667,7 +671,7 @@ namespace mongo { } } else { bool useful = false; - NamespaceDetails::IndexIterator j = nsdetails( _ns )->ii(); + NamespaceDetails::IndexIterator j = nsd->ii(); while( j.more() ) { IndexDetails &id = j.next(); if ( id.getSpec().suitability( *i, BSONObj() ) != USELESS ) { diff --git a/jstests/or8.js b/jstests/or8.js new file mode 100644 index 00000000000..c58507ee30e --- /dev/null +++ b/jstests/or8.js @@ -0,0 +1,6 @@ +// missing collection + +t = db.jstests_or8; +t.drop(); + +t.find({ "$or": [ { "PropA": { "$lt": "b" } }, { "PropA": { "$lt": "b", "$gt": "a" } } ] }).toArray(); diff --git a/mongo.xcodeproj/project.pbxproj b/mongo.xcodeproj/project.pbxproj index d14e0ff35a4..867ddc67034 100644 --- a/mongo.xcodeproj/project.pbxproj +++ b/mongo.xcodeproj/project.pbxproj @@ -444,6 +444,8 @@ 936B895E0F4C899400934AF2 /* message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = message.cpp; sourceTree = "<group>"; }; 936B895F0F4C899400934AF2 /* message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = message.h; sourceTree = "<group>"; }; 9378842D11C6C987007E85F5 /* indexh.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = indexh.js; sourceTree = "<group>"; }; + 937884C311C80276007E85F5 /* indexi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = indexi.js; sourceTree = "<group>"; }; + 937884E811C80B22007E85F5 /* or8.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = or8.js; sourceTree = "<group>"; }; 937C493311C0358D00836543 /* or7.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = or7.js; sourceTree = "<group>"; }; 937CACE90F27BF4900C57AA6 /* socktests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = socktests.cpp; sourceTree = "<group>"; }; 937D0E340F28CB070071FFA9 /* repltests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = repltests.cpp; sourceTree = "<group>"; }; @@ -818,6 +820,8 @@ 934BEB9A10DFFA9600178102 /* jstests */ = { isa = PBXGroup; children = ( + 937884E811C80B22007E85F5 /* or8.js */, + 937884C311C80276007E85F5 /* indexi.js */, 9378842D11C6C987007E85F5 /* indexh.js */, 937C493311C0358D00836543 /* or7.js */, 932D854611AB912B002749FB /* array_match1.js */, |