diff --git a/shell/db.js b/shell/db.js index 3a82ecb0798..eef7d8dcef0 100644 --- a/shell/db.js +++ b/shell/db.js @@ -533,9 +533,9 @@ DB.prototype.tojson = function(){ DB.prototype.toString = function(){ return this._name; -} - -DB.prototype.isMaster = function(){ return this.runCommand("isMaster");} +} + +DB.prototype.isMaster = function () { return this.runCommand("isMaster"); } DB.prototype.currentOp = function(){ return db.$cmd.sys.inprog.findOne(); diff --git a/shell/mongo_vstudio.cpp b/shell/mongo_vstudio.cpp index 14de9667a56..c07a096976a 100644 --- a/shell/mongo_vstudio.cpp +++ b/shell/mongo_vstudio.cpp @@ -659,10 +659,12 @@ const char * jsconcatcode = "print(\"\\trs.addArb(hostportstr) add a new member which is arbiterOnly:true\");\n" "print(\"\\trs.stepDown() step down as primary (momentarily)\");\n" "print(\"\\trs.conf() return configuration from local.system.replset\");\n" + "print(\"\\trs.slaveOk() shorthand for db.getMongo().setSlaveOk()\");\n" "print();\n" "print(\"\\tdb.isMaster() check who is primary\");\n" "print();\n" "print(\"\\tsee also http://:28017/_replSet for additional diagnostic info\");}\n" + "rs.slaveOk = function () { return db.getMongo().setSlaveOk(); }\n" "rs.status = function () { return db._adminCommand(\"replSetGetStatus\"); }\n" "rs.isMaster = function () { return db.isMaster(); }\n" "rs.initiate = function (c) { return db._adminCommand({ replSetInitiate: c }); }\n" @@ -990,7 +992,7 @@ const char * jsconcatcode = "return this._name;}\n" "DB.prototype.toString = function(){\n" "return this._name;}\n" - "DB.prototype.isMaster = function(){ return this.runCommand(\"isMaster\");}\n" + "DB.prototype.isMaster = function () { return this.runCommand(\"isMaster\"); }\n" "DB.prototype.currentOp = function(){\n" "return db.$cmd.sys.inprog.findOne();}\n" "DB.prototype.currentOP = DB.prototype.currentOp;\n" diff --git a/shell/msvc/mongo.vcxproj b/shell/msvc/mongo.vcxproj index ac69f2d9dd8..b158b9ecd48 100644 --- a/shell/msvc/mongo.vcxproj +++ b/shell/msvc/mongo.vcxproj @@ -116,6 +116,7 @@ + diff --git a/shell/msvc/mongo.vcxproj.filters b/shell/msvc/mongo.vcxproj.filters index 85309db6b79..426a8b06332 100644 --- a/shell/msvc/mongo.vcxproj.filters +++ b/shell/msvc/mongo.vcxproj.filters @@ -216,6 +216,9 @@ shell\generated_from_js + + shared source files + diff --git a/shell/utils.js b/shell/utils.js index fd0e6281a3c..65fb52ed073 100644 --- a/shell/utils.js +++ b/shell/utils.js @@ -1046,22 +1046,24 @@ Geo.distance = function( a , b ){ Math.pow( bx - ax , 2 ) ); } -rs = function () { return "try rs.help()"; } - -rs.help = function () { - print("\trs.status() { replSetGetStatus : 1 } checks repl set status"); - print("\trs.initiate() { replSetInitiate : null } initiates set with default settings"); - print("\trs.initiate(cfg) { replSetInitiate : cfg } initiates set with configuration cfg"); - print("\trs.add(hostportstr) add a new member to the set with default attributes"); - print("\trs.add(membercfgobj) add a new member to the set with extra attributes"); - print("\trs.addArb(hostportstr) add a new member which is arbiterOnly:true"); - print("\trs.stepDown() step down as primary (momentarily)"); - print("\trs.conf() return configuration from local.system.replset"); - print(); - print("\tdb.isMaster() check who is primary"); - print(); - print("\tsee also http://:28017/_replSet for additional diagnostic info"); -} +rs = function () { return "try rs.help()"; } + +rs.help = function () { + print("\trs.status() { replSetGetStatus : 1 } checks repl set status"); + print("\trs.initiate() { replSetInitiate : null } initiates set with default settings"); + print("\trs.initiate(cfg) { replSetInitiate : cfg } initiates set with configuration cfg"); + print("\trs.add(hostportstr) add a new member to the set with default attributes"); + print("\trs.add(membercfgobj) add a new member to the set with extra attributes"); + print("\trs.addArb(hostportstr) add a new member which is arbiterOnly:true"); + print("\trs.stepDown() step down as primary (momentarily)"); + print("\trs.conf() return configuration from local.system.replset"); + print("\trs.slaveOk() shorthand for db.getMongo().setSlaveOk()"); + print(); + print("\tdb.isMaster() check who is primary"); + print(); + print("\tsee also http://:28017/_replSet for additional diagnostic info"); +} +rs.slaveOk = function () { return db.getMongo().setSlaveOk(); } rs.status = function () { return db._adminCommand("replSetGetStatus"); } rs.isMaster = function () { return db.isMaster(); } rs.initiate = function (c) { return db._adminCommand({ replSetInitiate: c }); }