diff options
author | Cheahuychou Mao <cheahuychou.mao@mongodb.com> | 2020-03-03 16:18:53 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-10 17:37:41 +0000 |
commit | f042509f1c46e292cc14af7c7ba23b9cc97c5185 (patch) | |
tree | 859aebb6585424659b3039a5e03e308644faa87a /src/mongo/shell/query.js | |
parent | 64ec33d37d99a663ef27a0f8c1120785052aebea (diff) | |
download | mongo-f042509f1c46e292cc14af7c7ba23b9cc97c5185.tar.gz |
SERVER-46567 Update shell methods Mongo.setReadPref and cursor.readPref to support hedging
Diffstat (limited to 'src/mongo/shell/query.js')
-rw-r--r-- | src/mongo/shell/query.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js index cbdbeda2929..cb72bf0fff4 100644 --- a/src/mongo/shell/query.js +++ b/src/mongo/shell/query.js @@ -489,17 +489,21 @@ DBQuery.prototype.allowDiskUse = function() { * * @param mode {string} read preference mode to use. * @param tagSet {Array.<Object>} optional. The list of tags to use, order matters. - * Note that this object only keeps a shallow copy of this array. + * @param hedgeOptions {<Object>} optional. The hedge options of the form {enabled: <bool>}. * * @return this cursor */ -DBQuery.prototype.readPref = function(mode, tagSet) { +DBQuery.prototype.readPref = function(mode, tagSet, hedgeOptions) { var readPrefObj = {mode: mode}; if (tagSet) { readPrefObj.tags = tagSet; } + if (hedgeOptions) { + readPrefObj.hedge = hedgeOptions; + } + return this._addSpecial("$readPreference", readPrefObj); }; |