0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/pushall.js

21 lines
577 B
JavaScript
Raw Normal View History

2009-07-21 23:53:19 +02:00
t = db.jstests_pushall;
t.drop();
t.save( { a: [ 1, 2, 3 ] } );
t.update( {}, { $pushAll: { a: [ 4 ] } } );
assert.eq( [ 1, 2, 3, 4 ], t.findOne().a );
t.update( {}, { $pushAll: { a: [ 4 ] } } );
assert.eq( [ 1, 2, 3, 4, 4 ], t.findOne().a );
t.drop();
t.save( { a: [ 1, 2, 3 ] } );
t.update( {}, { $pushAll: { a: [ 4, 5 ] } } );
assert.eq( [ 1, 2, 3, 4, 5 ], t.findOne().a );
t.update( {}, { $pushAll: { a: [] } } );
assert.eq( [ 1, 2, 3, 4, 5 ], t.findOne().a );
2009-07-21 23:53:19 +02:00
2009-07-22 23:23:20 +02:00
t.drop();
t.save( {} );
t.update( {}, { $pushAll: { a: [ 1, 2 ] } } );
assert.eq( [ 1, 2 ], t.findOne().a );