summaryrefslogtreecommitdiff
path: root/src/mongo/shell/shardingtest.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell/shardingtest.js')
-rw-r--r--src/mongo/shell/shardingtest.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js
index 99ed173c615..e794e02c874 100644
--- a/src/mongo/shell/shardingtest.js
+++ b/src/mongo/shell/shardingtest.js
@@ -19,6 +19,8 @@
* contain:
* {
* nodes {number}: number of replica members. Defaults to 3.
+ * protocolVersion {number}: protocol version of replset used by the
+ * replset initiation.
* For other options, @see ReplSetTest#start
* }
*
@@ -64,10 +66,10 @@
* specify options that are common all replica members.
* useHostname {boolean}: if true, use hostname of machine,
* otherwise use localhost
- * numReplicas {number}
+ * numReplicas {number}
* }
* }
- *
+ *
* Member variables:
* s {Mongo} - connection to the first mongos
* s0, s1, ... {Mongo} - connection to different mongos
@@ -193,8 +195,10 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other
rsDefaults = Object.merge( rsDefaults, otherParams["rs" + i] )
rsDefaults.nodes = rsDefaults.nodes || otherParams.numReplicas
- var numReplicas = rsDefaults.nodes || 3
- delete rsDefaults.nodes
+ var numReplicas = rsDefaults.nodes || 3;
+ delete rsDefaults.nodes;
+ var protocolVersion = rsDefaults.protocolVersion;
+ delete rsDefaults.protocolVersion;
print( "Replica set test!" )
@@ -209,7 +213,11 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other
nodes : rs.startSet(rsDefaults),
url : rs.getURL() };
- rs.initiate();
+ var config = rs.getReplSetConfig();
+ if (protocolVersion !== undefined && protocolVersion !== null) {
+ config.protocolVersion = protocolVersion;
+ }
+ rs.initiate(config);
this["rs" + i] = rs
this._rsObjects[i] = rs