summaryrefslogtreecommitdiff
path: root/src/mongo/shell/utils.js
diff options
context:
space:
mode:
authorAli Mir <ali.mir@mongodb.com>2020-08-11 11:34:10 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-24 20:59:10 +0000
commit45924f56e67166a9bacc2f76516a9bc1ae37b53e (patch)
tree8e7171d774b2cb1109aba2ab0836b450a18f8ef8 /src/mongo/shell/utils.js
parent4419a5c2a0d099b40b2155dd4def37802286cb7c (diff)
downloadmongo-45924f56e67166a9bacc2f76516a9bc1ae37b53e.tar.gz
SERVER-49990 Alias setSlaveOk() and getSlaveOk() shell helpers
(cherry picked from commit d6fe50035aff8026937dff9d8544ff213ad05152)
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();
};