summaryrefslogtreecommitdiff
path: root/src/mongo/scripting
diff options
context:
space:
mode:
authorMatt Cotter <matt.cotter@mongodb.com>2016-08-11 18:00:08 -0400
committerMatt Cotter <matt.cotter@mongodb.com>2016-08-17 15:07:34 -0400
commitf68ec54403b78d185f5d9c87943a82ebb5166b81 (patch)
tree50a86efea173b37a9550f9afa8d284c401579c70 /src/mongo/scripting
parent7b3f66fc6a7398b732d49033480abf0832a70559 (diff)
downloadmongo-f68ec54403b78d185f5d9c87943a82ebb5166b81.tar.gz
SERVER-24132 add slaveOk to copyDB helper
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r--src/mongo/scripting/mozjs/mongo.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp
index ad7daff0f61..b7d9677fd0a 100644
--- a/src/mongo/scripting/mozjs/mongo.cpp
+++ b/src/mongo/scripting/mozjs/mongo.cpp
@@ -470,8 +470,8 @@ void MongoBase::Functions::copyDatabaseWithSCRAM::call(JSContext* cx, JS::CallAr
if (!conn)
uasserted(ErrorCodes::BadValue, "no connection");
- if (args.length() != 5)
- uasserted(ErrorCodes::BadValue, "copyDatabase needs 5 arg");
+ if (args.length() != 6)
+ uasserted(ErrorCodes::BadValue, "copyDatabase needs 6 arg");
// copyDatabase(fromdb, todb, fromhost, username, password);
std::string fromDb = ValueWriter(cx, args.get(0)).toString();
@@ -479,6 +479,7 @@ void MongoBase::Functions::copyDatabaseWithSCRAM::call(JSContext* cx, JS::CallAr
std::string fromHost = ValueWriter(cx, args.get(2)).toString();
std::string user = ValueWriter(cx, args.get(3)).toString();
std::string password = ValueWriter(cx, args.get(4)).toString();
+ bool slaveOk = ValueWriter(cx, args.get(5)).toBoolean();
std::string hashedPwd = DBClientWithCommands::createPasswordDigest(user, password);
@@ -494,8 +495,9 @@ void MongoBase::Functions::copyDatabaseWithSCRAM::call(JSContext* cx, JS::CallAr
<< saslCommandMechanismFieldName
<< "SCRAM-SHA-1");
- BSONObj saslFollowupCommandPrefix =
- BSON("copydb" << 1 << "fromhost" << fromHost << "fromdb" << fromDb << "todb" << toDb);
+ BSONObj saslFollowupCommandPrefix = BSON(
+ "copydb" << 1 << "fromhost" << fromHost << "fromdb" << fromDb << "todb" << toDb << "slaveOk"
+ << slaveOk);
BSONObj saslCommandPrefix = saslFirstCommandPrefix;
BSONObj inputObj = BSON(saslCommandPayloadFieldName << "");