diff options
Diffstat (limited to 'jstests/sharding/read_pref_cmd.js')
-rw-r--r-- | jstests/sharding/read_pref_cmd.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js index bd2808017a5..27bdedc44e3 100644 --- a/jstests/sharding/read_pref_cmd.js +++ b/jstests/sharding/read_pref_cmd.js @@ -307,9 +307,11 @@ let testConnReadPreference = function(conn, isMongos, rsNodes, {readPref, expect cmdTest( {dbStats: 1}, allowedOnSecondary.kAlways, true, formatProfileQuery(kDbName, {dbStats: 1})); - assert.commandWorked(shardedColl.createIndex({loc: '2d'})); - - assert.commandWorked(testDB.runCommand({getLastError: 1, w: nodeCount})); + assert.commandWorked(testDB.runCommand({ + createIndexes: shardedColl.getName(), + indexes: [{key: {loc: '2d'}, name: '2d'}], + writeConcern: {w: nodeCount} + })); // Test on sharded cmdTest({aggregate: kShardedCollName, pipeline: [{$project: {x: 1}}], cursor: {}}, |