diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2013-11-08 15:03:15 -0500 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2013-11-09 18:20:08 -0500 |
commit | 8763f2868b3c1470ebfdb8490370c7cb1ee40301 (patch) | |
tree | 18d0a73c0e4c4399edd15f5c784a525964813aba /src/mongo/db/ops/query.cpp | |
parent | 989fd71aa5931a61f2028e51b3ffc2b144cd9cfa (diff) | |
download | mongo-8763f2868b3c1470ebfdb8490370c7cb1ee40301.tar.gz |
SERVER-10026 add computed data to projection
Diffstat (limited to 'src/mongo/db/ops/query.cpp')
-rw-r--r-- | src/mongo/db/ops/query.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/mongo/db/ops/query.cpp b/src/mongo/db/ops/query.cpp index c0f5889cf99..32c98cbcb03 100644 --- a/src/mongo/db/ops/query.cpp +++ b/src/mongo/db/ops/query.cpp @@ -1029,28 +1029,16 @@ namespace mongo { * @asserts on scan and order memory exhaustion and other cases. */ string runQuery(Message& m, QueryMessage& q, CurOp& curop, Message &result) { - shared_ptr<ParsedQuery> pq_shared( new ParsedQuery(q) ); - ParsedQuery& pq( *pq_shared ); BSONObj jsobj = q.query; int queryOptions = q.queryOptions; const char *ns = q.ns; - - uassert( 16332 , "can't have an empty ns" , ns[0] ); - - LOG(2) << "runQuery called " << ns << " " << jsobj << endl; - - curop.debug().ns = ns; - curop.debug().ntoreturn = pq.getNumToReturn(); - curop.debug().query = jsobj; - curop.setQuery(jsobj); const NamespaceString nsString( ns ); uassert( 16256, str::stream() << "Invalid ns [" << ns << "]", nsString.isValid() ); // Run a command. - if ( nsString.isCommand() ) { - int nToReturn = pq.getNumToReturn(); + int nToReturn = q.ntoreturn; uassert( 16979, str::stream() << "bad numberToReturn (" << nToReturn << ") for $cmd type ns - can only be 1 or -1", nToReturn == 1 || nToReturn == -1 ); @@ -1081,6 +1069,26 @@ namespace mongo { return ""; } + if (isNewQueryFrameworkEnabled()) { + // TODO: Copy prequel curop debugging into runNewQuery + CanonicalQuery* cq = NULL; + if (canUseNewSystem(q, &cq)) { + return newRunQuery(cq, curop, result); + } + } + + shared_ptr<ParsedQuery> pq_shared( new ParsedQuery(q) ); + ParsedQuery& pq( *pq_shared ); + + uassert( 16332 , "can't have an empty ns" , ns[0] ); + + LOG(2) << "runQuery called " << ns << " " << jsobj << endl; + + curop.debug().ns = ns; + curop.debug().ntoreturn = pq.getNumToReturn(); + curop.debug().query = jsobj; + curop.setQuery(jsobj); + bool explain = pq.isExplain(); BSONObj order = pq.getOrder(); BSONObj query = pq.getFilter(); @@ -1096,14 +1104,6 @@ namespace mongo { uassert( 10110 , "bad query object", false); } - if (isNewQueryFrameworkEnabled()) { - // TODO: Copy prequel curop debugging into runNewQuery - CanonicalQuery* cq = NULL; - if (canUseNewSystem(q, &cq)) { - return newRunQuery(cq, curop, result); - } - } - // Handle query option $maxTimeMS (not used with commands). curop.setMaxTimeMicros(static_cast<unsigned long long>(pq.getMaxTimeMS()) * 1000); killCurrentOp.checkForInterrupt(); // May trigger maxTimeAlwaysTimeOut fail point. |