diff options
Diffstat (limited to 'jstests/core/bench_test3.js')
-rw-r--r-- | jstests/core/bench_test3.js | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/jstests/core/bench_test3.js b/jstests/core/bench_test3.js index 2e130662829..24e230cc16d 100644 --- a/jstests/core/bench_test3.js +++ b/jstests/core/bench_test3.js @@ -1,15 +1,18 @@ t = db.bench_test3; t.drop(); - -benchArgs = { ops : [ { ns : t.getFullName() , - op : "update" , - upsert : true , - query : { _id : { "#RAND_INT" : [ 0 , 5 , 4 ] } } , - update : { $inc : { x : 1 } } } ] , - parallel : 2 , - seconds : 5 , - host : db.getMongo().host }; +benchArgs = { + ops: [{ + ns: t.getFullName(), + op: "update", + upsert: true, + query: {_id: {"#RAND_INT": [0, 5, 4]}}, + update: {$inc: {x: 1}} + }], + parallel: 2, + seconds: 5, + host: db.getMongo().host +}; if (jsTest.options().auth) { benchArgs['db'] = 'admin'; @@ -17,11 +20,14 @@ if (jsTest.options().auth) { benchArgs['password'] = jsTest.options().adminPassword; } -res = benchRun( benchArgs ); -printjson( res ); +res = benchRun(benchArgs); +printjson(res); var keys = []; var totals = {}; -db.bench_test3.find().sort( { _id : 1 } ).forEach( function(z){ keys.push( z._id ); totals[z._id] = z.x; } ); +db.bench_test3.find().sort({_id: 1}).forEach(function(z) { + keys.push(z._id); + totals[z._id] = z.x; +}); printjson(totals); -assert.eq( [ 0 , 4 , 8 , 12 , 16 ] , keys ); +assert.eq([0, 4, 8, 12, 16], keys); |