diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py index 841382d8bac..30ac3aa4004 100755 --- a/buildscripts/smoke.py +++ b/buildscripts/smoke.py @@ -469,7 +469,7 @@ def runTest(test, result): path = argv[1] elif ext == ".js": argv = [shell_executable, "--port", mongod_port, '--authenticationMechanism', authMechanism] - if use_write_commands: + if use_write_commands or "aggregation" in path: argv += ["--writeMode", "commands"] else: argv += ["--writeMode", shell_write_mode] diff --git a/jstests/aggregation/bugs/server4638.js b/jstests/aggregation/bugs/server4638.js index 20aa6168a4d..bb75aba99b2 100644 --- a/jstests/aggregation/bugs/server4638.js +++ b/jstests/aggregation/bugs/server4638.js @@ -6,8 +6,6 @@ t.drop(); t.insert( { _id : 0 , x : 0 , undef: undefined } ); -db.getLastError(); - // Make sure having an undefined doesn't break pipelines not using the field res = t.aggregate( { $project : { x : 1 } } ).toArray(); assert.eq(res[0].x, 0); diff --git a/jstests/aggregation/bugs/server6118.js b/jstests/aggregation/bugs/server6118.js index 8a9811179fc..56e23af8e5a 100644 --- a/jstests/aggregation/bugs/server6118.js +++ b/jstests/aggregation/bugs/server6118.js @@ -15,7 +15,6 @@ N = 100; for( i = 0; i < N; ++i ) { d.data.insert( { _id:i } ) } -d.getLastError(); // Split the data into 3 chunks. s.adminCommand( { split:"test.data", middle:{ _id:33 } } ); diff --git a/jstests/aggregation/bugs/server6179.js b/jstests/aggregation/bugs/server6179.js index 7bc553da693..f5cf6259c4f 100644 --- a/jstests/aggregation/bugs/server6179.js +++ b/jstests/aggregation/bugs/server6179.js @@ -12,7 +12,6 @@ d = s.getDB( "test" ); for( i = 0; i < 100; ++i ) { d.data.insert( { _id:i, i:i%10 } ) } -d.getLastError(); // Split the data into 3 chunks. s.adminCommand( { split:"test.data", middle:{ _id:33 } } ); diff --git a/jstests/aggregation/bugs/server7781.js b/jstests/aggregation/bugs/server7781.js index 6ca413e3a21..e22ae786803 100644 --- a/jstests/aggregation/bugs/server7781.js +++ b/jstests/aggregation/bugs/server7781.js @@ -66,10 +66,12 @@ function test(db, sharded, indexType) { // insert points var numPts = 10*1000; + var bulk = db[coll].initializeUnorderedBulkOp(); for (var i=0; i < numPts; i++) { - db[coll].insert({rand:Math.random(), loc: pointMaker.mkPt()}); + bulk.insert({ rand: Math.random(), loc: pointMaker.mkPt() }); } - db.getLastError(); + assert.writeOK(bulk.execute()); + assert.eq(db[coll].count(), numPts); db[coll].ensureIndex({loc: indexType}); diff --git a/jstests/aggregation/mongos_slaveok.js b/jstests/aggregation/mongos_slaveok.js index eddebdf1938..52790b6f11d 100644 --- a/jstests/aggregation/mongos_slaveok.js +++ b/jstests/aggregation/mongos_slaveok.js @@ -13,8 +13,7 @@ if (doSharded) { testDB.adminCommand({ shardCollection: 'test.user', key: { x: 1 }}); } -testDB.user.insert({ x: 10 }); -testDB.runCommand({ getLastError: 1, w: NODES }); +testDB.user.insert({ x: 10 }, { writeConcern: { w: NODES }}); testDB.setSlaveOk(true); var secNode = st.rs0.getSecondary(); diff --git a/jstests/aggregation/testSlave.js b/jstests/aggregation/testSlave.js index 04c390abc1b..36ce353e784 100644 --- a/jstests/aggregation/testSlave.js +++ b/jstests/aggregation/testSlave.js @@ -7,10 +7,10 @@ replTest.awaitReplication(); var mast = nodes[0].getDB('test'); var slav = nodes[1].getDB('test'); -mast.agg.insert({}); -mast.agg.insert({}); -mast.agg.insert({}); -mast.getLastError(2); +var options = { writeConcern: { w: 2 }}; +mast.agg.insert({}, options); +mast.agg.insert({}, options); +mast.agg.insert({}, options); var res = slav.agg.aggregate({$group: {_id: null, count: {$sum: 1}}}); assert.eq(res.toArray(), [{_id:null, count: 3}]); diff --git a/jstests/aggregation/testshard1.js b/jstests/aggregation/testshard1.js index 5e422a94458..a87d07f9590 100644 --- a/jstests/aggregation/testshard1.js +++ b/jstests/aggregation/testshard1.js @@ -74,14 +74,13 @@ var strings = [ ]; var nItems = 200000; +var bulk = db.ts1.initializeUnorderedBulkOp(); for(i = 1; i <= nItems; ++i) { - db.ts1.save( + bulk.insert( {counter: ++count, number: strings[i % 20], random: Math.random(), filler: "0123456789012345678901234567890123456789"}); } - -// wait for all writebacks to be applied -assert.eq(db.getLastError(), null); +assert.writeOK(bulk.execute()); // Turn on exception tracing in mongod to figure out exactly where the SCEs are coming from // TEMPORARY - REMOVE ONCE SERVER-9622 IS RESOLVED @@ -145,8 +144,8 @@ for(i = 0 ; i < strings.length; ++i) { // a match takes place in the shards; just returning the results from mongos var a4 = aggregateNoOrder(db.ts1, [ { $match: {$or:[{counter:55}, {counter:1111}, - {counter: 2222}, {counter: 33333}, - {counter: 99999}, {counter: 55555}]} + {counter: 2222}, {counter: 3333}, + {counter: 9999}, {counter: 5555}]} } ]);