2010-03-16 14:05:41 -07:00
|
|
|
t = db.jstests_pullall;
|
2009-07-21 18:37:30 -04:00
|
|
|
t.drop();
|
|
|
|
|
|
|
|
|
|
t.save( { a: [ 1, 2, 3 ] } );
|
|
|
|
|
t.update( {}, { $pullAll: { a: [ 3 ] } } );
|
|
|
|
|
assert.eq( [ 1, 2 ], t.findOne().a );
|
|
|
|
|
t.update( {}, { $pullAll: { a: [ 3 ] } } );
|
|
|
|
|
assert.eq( [ 1, 2 ], t.findOne().a );
|
|
|
|
|
|
|
|
|
|
t.drop();
|
|
|
|
|
t.save( { a: [ 1, 2, 3 ] } );
|
|
|
|
|
t.update( {}, { $pullAll: { a: [ 2, 3 ] } } );
|
|
|
|
|
assert.eq( [ 1 ], t.findOne().a );
|
|
|
|
|
t.update( {}, { $pullAll: { a: [] } } );
|
|
|
|
|
assert.eq( [ 1 ], t.findOne().a );
|
|
|
|
|
t.update( {}, { $pullAll: { a: [ 1, 5 ] } } );
|
|
|
|
|
assert.eq( [], t.findOne().a );
|
|
|
|
|
|