summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorJordi Serra Torrens <jordi.serra-torrens@mongodb.com>2021-02-18 15:20:19 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-19 15:03:26 +0000
commit822232665be8d186ae5801659221197a19180aef (patch)
treea47e9db127c8d33668c37181b0e9fb9db5b0c4c7 /src/mongo/shell
parent4d17b3187bbed50668a164cc685458f3c6f8ae22 (diff)
downloadmongo-822232665be8d186ae5801659221197a19180aef.tar.gz
SERVER-54132: Review usages of config.collections 'dropped' field
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/collection.js4
-rw-r--r--src/mongo/shell/utils_sh.js2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/shell/collection.js b/src/mongo/shell/collection.js
index 2043fcfbe74..fa495abde73 100644
--- a/src/mongo/shell/collection.js
+++ b/src/mongo/shell/collection.js
@@ -1123,8 +1123,10 @@ DBCollection.autocomplete = function(obj) {
* @return {boolean}
*/
DBCollection.prototype._isSharded = function() {
+ // Checking for 'dropped: {$ne: true}' to ensure mongo shell compatibility with earlier versions
+ // of the server
return !!this._db.getSiblingDB("config").collections.countDocuments(
- {_id: this._fullName, dropped: false});
+ {_id: this._fullName, dropped: {$ne: true}});
};
/**
diff --git a/src/mongo/shell/utils_sh.js b/src/mongo/shell/utils_sh.js
index c165ab1695c..cb0bf13badd 100644
--- a/src/mongo/shell/utils_sh.js
+++ b/src/mongo/shell/utils_sh.js
@@ -744,6 +744,8 @@ function printShardingStatus(configDB, verbose) {
configDB.collections.find({_id: new RegExp("^" + RegExp.escape(db._id) + "\\.")})
.sort({_id: 1})
.forEach(function(coll) {
+ // Checking for '!dropped' to ensure mongo shell compatibility with earlier
+ // versions of the server
if (!coll.dropped) {
output(3, coll._id);
output(4, "shard key: " + tojson(coll.key));