diff options
author | Misha Ivkov <misha.ivkov@10gen.com> | 2019-07-03 18:27:47 -0400 |
---|---|---|
committer | Misha Ivkov <misha.ivkov@10gen.com> | 2019-07-12 16:26:59 -0400 |
commit | e6c531c7bc01e628052792a5c94c6da3e5779adf (patch) | |
tree | 0c1f32fa0fb7db1b3ccb2235c00f849fbbb660df /src/mongo/shell/query.js | |
parent | deaf23e643efa664338d602b419589639409b33a (diff) | |
download | mongo-e6c531c7bc01e628052792a5c94c6da3e5779adf.tar.gz |
SERVER-42077 Add 'allowDiskUse' option to find command
Diffstat (limited to 'src/mongo/shell/query.js')
-rw-r--r-- | src/mongo/shell/query.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js index 4304903ca36..def25f8f65a 100644 --- a/src/mongo/shell/query.js +++ b/src/mongo/shell/query.js @@ -47,6 +47,7 @@ DBQuery.prototype.help = function() { print("\t.allowPartialResults()"); print("\t.returnKey()"); print("\t.showRecordId() - adds a $recordId field to each returned object"); + print("\t.allowDiskUse() - allow using disk in completing the query"); print("\nCursor methods"); print("\t.toArray() - iterates through docs and returns an array of the results"); @@ -127,6 +128,10 @@ DBQuery.prototype._exec = function() { throw new Error("collation requires use of read commands"); } + if (this._special && this._query._allowDiskUse) { + throw new Error("allowDiskUse option requires use of read commands"); + } + this._cursor = this._mongo.find(this._ns, this._query, this._fields, @@ -225,6 +230,10 @@ DBQuery.prototype._convertToCommand = function(canAttachReadPref) { cmd["collation"] = this._query.collation; } + if ("allowDiskUse" in this._query) { + cmd["allowDiskUse"] = this._query.allowDiskUse; + } + if ((this._options & DBQuery.Option.tailable) != 0) { cmd["tailable"] = true; } @@ -471,6 +480,10 @@ DBQuery.prototype.collation = function(collationSpec) { return this._addSpecial("collation", collationSpec); }; +DBQuery.prototype.allowDiskUse = function() { + return this._addSpecial("allowDiskUse", true); +}; + /** * Sets the read preference for this cursor. * |