From 41005a73c8534953c4627b2a9d82a776e4276f1f Mon Sep 17 00:00:00 2001 From: Matthew Russotto Date: Tue, 14 Aug 2018 13:38:17 -0400 Subject: SERVER-36094 Make DBClientBase::query() take an NamespaceStringOrUUID --- src/mongo/scripting/engine.cpp | 2 +- src/mongo/scripting/mozjs/mongo.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/mongo/scripting') diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index 57a5d98f1e6..996225e5fbe 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -215,7 +215,7 @@ void Scope::loadStored(OperationContext* opCtx, bool ignoreNotConnected) { return; _loadedVersion = lastVersion; - string coll = _localDBName + ".system.js"; + NamespaceString coll(_localDBName, "system.js"); auto directDBClient = DBDirectClientFactory::get(opCtx).create(opCtx); diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp index 0b88d21fb60..14a9cc8972a 100644 --- a/src/mongo/scripting/mozjs/mongo.cpp +++ b/src/mongo/scripting/mozjs/mongo.cpp @@ -291,8 +291,13 @@ void MongoBase::Functions::find::call(JSContext* cx, JS::CallArgs args) { // The shell only calls this method when it wants to test OP_QUERY. options |= DBClientCursor::QueryOptionLocal_forceOpQuery; - std::unique_ptr cursor( - conn->query(ns, q, nToReturn, nToSkip, haveFields ? &fields : NULL, options, batchSize)); + std::unique_ptr cursor(conn->query(NamespaceString(ns), + q, + nToReturn, + nToSkip, + haveFields ? &fields : NULL, + options, + batchSize)); if (!cursor.get()) { uasserted(ErrorCodes::InternalError, "error doing query: failed"); } @@ -490,7 +495,7 @@ void MongoBase::Functions::cursorFromId::call(JSContext* cx, JS::CallArgs args) // The shell only calls this method when it wants to test OP_GETMORE. auto cursor = stdx::make_unique( - conn, ns, cursorId, 0, DBClientCursor::QueryOptionLocal_forceOpQuery); + conn, NamespaceString(ns), cursorId, 0, DBClientCursor::QueryOptionLocal_forceOpQuery); if (args.get(2).isNumber()) cursor->setBatchSize(ValueWriter(cx, args.get(2)).toInt32()); -- cgit v1.2.1