summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorJustin Seyster <justin.seyster@mongodb.com>2019-04-24 14:29:19 -0400
committerJustin Seyster <justin.seyster@mongodb.com>2019-04-24 14:30:13 -0400
commit0e9dcfbff4846e848b82e9c99f0d950dd7eaeae1 (patch)
tree9cfe88b2e7fa304f5f9a9b7443f7ccef5eaafde5 /src/mongo/shell
parent8ffbd4892537721fca0a640a3bced2cfa21e4c59 (diff)
downloadmongo-0e9dcfbff4846e848b82e9c99f0d950dd7eaeae1.tar.gz
Revert "SERVER-35638 Short timeout to autocomplete collection names"
This reverts commit f202c4c1ba24b9f561e8b11dac5b04fa0eeb4919.
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/db.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 43123fd9361..d12e872e417 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -816,16 +816,14 @@ var DB;
DB.prototype.getLastErrorCmd = DB.prototype.getLastErrorObj;
DB.prototype._getCollectionInfosCommand = function(
- filter, nameOnly = false, authorizedCollections = false, options = {}) {
+ filter, nameOnly = false, authorizedCollections = false) {
filter = filter || {};
- const cmd = {
+ var res = this.runCommand({
listCollections: 1,
filter: filter,
nameOnly: nameOnly,
authorizedCollections: authorizedCollections
- };
-
- const res = this.runCommand(Object.merge(cmd, options));
+ });
if (!res.ok) {
throw _getErrorWithCode(res, "listCollections failed: " + tojson(res));
}
@@ -900,17 +898,13 @@ var DB;
}
};
- DB.prototype._getCollectionNamesInternal = function(options) {
- return this._getCollectionInfosCommand({}, true, true, options).map(function(infoObj) {
- return infoObj.name;
- });
- };
-
/**
* Returns this database's list of collection names in sorted order.
*/
DB.prototype.getCollectionNames = function() {
- return this._getCollectionNamesInternal({});
+ return this.getCollectionInfos({}, true, true).map(function(infoObj) {
+ return infoObj.name;
+ });
};
DB.prototype.tojson = function() {
@@ -1255,8 +1249,7 @@ var DB;
};
DB.autocomplete = function(obj) {
- // Time out if a transaction or other op holds locks we need. Caller suppresses exceptions.
- var colls = obj._getCollectionNamesInternal({maxTimeMS: 1000});
+ var colls = obj.getCollectionNames();
var ret = [];
for (var i = 0; i < colls.length; i++) {
if (colls[i].match(/^[a-zA-Z0-9_.\$]+$/))