summaryrefslogtreecommitdiff
path: root/src/mongo/shell/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell/utils.js')
-rw-r--r--src/mongo/shell/utils.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index 9b2f9dae9e1..5bf0a089e92 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -1467,7 +1467,7 @@ rs.help = function() {
"\trs.freeze(secs) make a node ineligible to become primary for the time specified");
print(
"\trs.remove(hostportstr) remove a host from the replica set (disconnects)");
- print("\trs.slaveOk() allow queries on secondary nodes");
+ print("\trs.secondaryOk() allow queries on secondary nodes");
print();
print("\trs.printReplicationInfo() check oplog size and time range");
print(
@@ -1478,8 +1478,15 @@ rs.help = function() {
print("\tan error, even if the command succeeds.");
};
rs.slaveOk = function(value) {
- return db.getMongo().setSlaveOk(value);
+ print(
+ "WARNING: slaveOk() is deprecated and may be removed in the next major release. Please use secondaryOk() instead.");
+ return db.getMongo().setSecondaryOk(value);
+};
+
+rs.secondaryOk = function(value) {
+ return db.getMongo().setSecondaryOk(value);
};
+
rs.status = function() {
return db._adminCommand("replSetGetStatus");
};
@@ -1612,7 +1619,7 @@ rs.debug = {};
rs.debug.nullLastOpWritten = function(primary, secondary) {
var p = connect(primary + "/local");
var s = connect(secondary + "/local");
- s.getMongo().setSlaveOk();
+ s.getMongo().setSecondaryOk();
var secondToLast = s.oplog.rs.find().sort({$natural: -1}).limit(1).next();
var last = p.runCommand({
@@ -1637,7 +1644,7 @@ rs.debug.getLastOpWritten = function(server) {
if (server) {
s = connect(server + "/local");
}
- s.getMongo().setSlaveOk();
+ s.getMongo().setSecondaryOk();
return s.oplog.rs.find().sort({$natural: -1}).limit(1).next();
};