mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
26 lines
431 B
JavaScript
26 lines
431 B
JavaScript
|
|
t = db.update_multi3;
|
|
|
|
function test( useIndex ){
|
|
t.drop();
|
|
|
|
if ( useIndex )
|
|
t.ensureIndex({k:1})
|
|
|
|
for (i=0; i<10; i++) {
|
|
t.save({ _id : i , k: 'x', a: []});
|
|
}
|
|
|
|
t.update({k: 'x'}, {$push: {a: 'y'}}, false, true);
|
|
|
|
t.find( { k : "x" } ).forEach(
|
|
function(z){
|
|
assert.eq( [ "y" ] , z.a , "useIndex: " + useIndex )
|
|
}
|
|
);
|
|
|
|
}
|
|
|
|
test( false )
|
|
test( true )
|