diff options
Diffstat (limited to 'jstests/core/removec.js')
-rw-r--r-- | jstests/core/removec.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/jstests/core/removec.js b/jstests/core/removec.js index b062399bdb5..f2c4e29e4fc 100644 --- a/jstests/core/removec.js +++ b/jstests/core/removec.js @@ -2,37 +2,35 @@ t = db.jstests_removec; t.drop(); -t.ensureIndex( { a:1 } ); +t.ensureIndex({a: 1}); /** @return an array containing a sequence of numbers from i to i + 10. */ -function runStartingWith( i ) { +function runStartingWith(i) { ret = []; - for( j = 0; j < 11; ++j ) { - ret.push( i + j ); + for (j = 0; j < 11; ++j) { + ret.push(i + j); } return ret; } // Insert some documents with adjacent index keys. -for( i = 0; i < 1100; i += 11 ) { - t.save( { a:runStartingWith( i ) } ); +for (i = 0; i < 1100; i += 11) { + t.save({a: runStartingWith(i)}); } // Remove and then reinsert random documents in the background. -s = startParallelShell( - 't = db.jstests_removec;' + +s = startParallelShell('t = db.jstests_removec;' + 'Random.setRandomSeed();' + 'for( j = 0; j < 1000; ++j ) {' + ' o = t.findOne( { a:Random.randInt( 1100 ) } );' + ' t.remove( { _id:o._id } );' + ' t.insert( o );' + - '}' - ); + '}'); // Find operations are error free. Note that the cursor throws if it detects the $err // field in the returned document. -for( i = 0; i < 200; ++i ) { - t.find( { a:{ $gte:0 } } ).hint( { a:1 } ).itcount(); +for (i = 0; i < 200; ++i) { + t.find({a: {$gte: 0}}).hint({a: 1}).itcount(); } s(); |