summaryrefslogtreecommitdiff
path: root/src/mongo/shell/db.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-20 21:14:32 +0000
commitd6fe50035aff8026937dff9d8544ff213ad05152 (patch)
tree6e600e6cd823d2110de686e16b5745f6d8095783 /src/mongo/shell/db.js
parent48608c570f1357d640bc80d114b4d04cf6a55743 (diff)
downloadmongo-d6fe50035aff8026937dff9d8544ff213ad05152.tar.gz
SERVER-49990 Alias setSlaveOk() and getSlaveOk() shell helpers
Diffstat (limited to 'src/mongo/shell/db.js')
-rw-r--r--src/mongo/shell/db.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 44c9a9b24d9..bcbddeb91a3 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -560,7 +560,7 @@ DB.prototype.help = function() {
print("\tdb.getLastErrorObj() - return full status object");
print("\tdb.getLogComponents()");
print("\tdb.getMongo() get the server connection object");
- print("\tdb.getMongo().setSlaveOk() allow queries on a replication slave server");
+ print("\tdb.getMongo().setSecondaryOk() allow queries on a replication secondary server");
print("\tdb.getName()");
print("\tdb.getProfilingLevel() - deprecated");
print("\tdb.getProfilingStatus() - returns if profiling is on and slow threshold");
@@ -1251,20 +1251,32 @@ DB.autocomplete = function(obj) {
};
DB.prototype.setSlaveOk = function(value) {
+ print(
+ "WARNING: setSlaveOk() is deprecated and may be removed in the next major release. Please use setSecondaryOk() instead.");
+ this.setSecondaryOk(value);
+};
+
+DB.prototype.getSlaveOk = function() {
+ print(
+ "WARNING: getSlaveOk() is deprecated and may be removed in the next major release. Please use getSecondaryOk() instead.");
+ return this.getSecondaryOk();
+};
+
+DB.prototype.setSecondaryOk = function(value) {
if (value == undefined)
value = true;
- this._slaveOk = value;
+ this._secondaryOk = value;
};
-DB.prototype.getSlaveOk = function() {
- if (this._slaveOk != undefined)
- return this._slaveOk;
- return this._mongo.getSlaveOk();
+DB.prototype.getSecondaryOk = function() {
+ if (this._secondaryOk != undefined)
+ return this._secondaryOk;
+ return this._mongo.getSecondaryOk();
};
DB.prototype.getQueryOptions = function() {
var options = 0;
- if (this.getSlaveOk())
+ if (this.getSecondaryOk())
options |= 4;
return options;
};