summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-02-26 14:07:02 -0500
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-02-27 09:57:51 -0500
commit16865377fb96a4ecefd28c6aa349de6ae85a8c57 (patch)
tree11e669ce85cd757099e8ce29c7f900e681d28207 /src/mongo/shell
parent906df445b9b994dd2f8e5ae481400876412497b2 (diff)
downloadmongo-16865377fb96a4ecefd28c6aa349de6ae85a8c57.tar.gz
SERVER-39760 Add commitQuorum field to createIndex(es) shell helpers
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/collection.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/shell/collection.js b/src/mongo/shell/collection.js
index 2f1e2c96686..0c3670d7f2f 100644
--- a/src/mongo/shell/collection.js
+++ b/src/mongo/shell/collection.js
@@ -624,11 +624,11 @@ DBCollection.prototype._indexSpec = function(keys, options) {
return ret;
};
-DBCollection.prototype.createIndex = function(keys, options) {
- return this.createIndexes([keys], options);
+DBCollection.prototype.createIndex = function(keys, options, commitQuorum) {
+ return this.createIndexes([keys], options, commitQuorum);
};
-DBCollection.prototype.createIndexes = function(keys, options) {
+DBCollection.prototype.createIndexes = function(keys, options, commitQuorum) {
if (!Array.isArray(keys)) {
throw new Error("createIndexes first argument should be an array");
}
@@ -641,7 +641,12 @@ DBCollection.prototype.createIndexes = function(keys, options) {
for (var i = 0; i < indexSpecs.length; i++) {
delete (indexSpecs[i].ns); // ns is passed to the first element in the command.
}
- return this._db.runCommand({createIndexes: this.getName(), indexes: indexSpecs});
+
+ if (commitQuorum === undefined) {
+ return this._db.runCommand({createIndexes: this.getName(), indexes: indexSpecs});
+ }
+ return this._db.runCommand(
+ {createIndexes: this.getName(), indexes: indexSpecs, commitQuorum: commitQuorum});
};
DBCollection.prototype.ensureIndex = function(keys, options) {