Files
mongo/jstests/core/pullall2.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

21 lines
500 B
JavaScript

t = db.pullall2
t.drop()
o = { _id : 1 , a : [] }
for ( i=0; i<5; i++ )
o.a.push( { x : i , y : i } )
t.insert( o )
assert.eq( o , t.findOne() , "A" );
t.update( {} , { $pull : { a : { x : 3 } } } )
o.a = o.a.filter( function(z){ return z.x != 3 } )
assert.eq( o , t.findOne() , "B" );
t.update( {} , { $pull : { a : { x : { $in : [ 1 , 4 ] } } } } );
o.a = o.a.filter( function(z){ return z.x != 1 } )
o.a = o.a.filter( function(z){ return z.x != 4 } )
assert.eq( o , t.findOne() , "C" );