diff options
Diffstat (limited to 'src/mongo/db/commands/mr.cpp')
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 8b395343a14..f32ebe3b8d8 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -781,8 +781,8 @@ void State::init() { _scope->invoke(init, 0, 0, 0, true); // js function to run reduce on all keys - // redfunc = _scope->createFunction("for (var key in hashmap) { print('Key is ' + key); list = - // hashmap[key]; ret = reduce(key, list); print('Value is ' + ret); };"); + // redfunc = _scope->createFunction("for (var key in hashmap) { print('Key is ' + key); + // list = hashmap[key]; ret = reduce(key, list); print('Value is ' + ret); };"); _reduceAll = _scope->createFunction( "var map = _mrMap;" "var list, ret;" @@ -1004,10 +1004,10 @@ void State::finalReduce(CurOp* op, ProgressMeterHolder& pm) { const NamespaceString nss(_config.incLong); const WhereCallbackReal whereCallback(_txn, nss.db()); - auto statusWithCQ = - CanonicalQuery::canonicalize(_config.incLong, BSONObj(), sortKey, BSONObj(), whereCallback); - verify(statusWithCQ.isOK()); - std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); + CanonicalQuery* cqRaw; + verify(CanonicalQuery::canonicalize( + _config.incLong, BSONObj(), sortKey, BSONObj(), &cqRaw, whereCallback).isOK()); + std::unique_ptr<CanonicalQuery> cq(cqRaw); Collection* coll = getCollectionOrUassert(ctx->getDb(), _config.incLong); invariant(coll); @@ -1363,13 +1363,14 @@ public: const WhereCallbackReal whereCallback(txn, nss.db()); - auto statusWithCQ = CanonicalQuery::canonicalize( - config.ns, config.filter, config.sort, BSONObj(), whereCallback); - if (!statusWithCQ.isOK()) { + CanonicalQuery* cqRaw; + if (!CanonicalQuery::canonicalize( + config.ns, config.filter, config.sort, BSONObj(), &cqRaw, whereCallback) + .isOK()) { uasserted(17238, "Can't canonicalize query " + config.filter.toString()); return 0; } - std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); + std::unique_ptr<CanonicalQuery> cq(cqRaw); Database* db = scopedAutoDb->getDb(); Collection* coll = state.getCollectionOrUassert(db, config.ns); |