diff options
author | Aaron Staple <aaron@10gen.com> | 2009-07-21 18:37:30 -0400 |
---|---|---|
committer | Aaron Staple <aaron@10gen.com> | 2009-07-21 18:37:30 -0400 |
commit | c477ed3a158354c7f31d950bac6b3a373acc5d1d (patch) | |
tree | 7b83e493e4e0533fbd71ce93da7e1e6832939321 /jstests/pullall.js | |
parent | 9c44b1c8642dde6d5cb3513728bbfcd235ffe03f (diff) | |
download | mongo-c477ed3a158354c7f31d950bac6b3a373acc5d1d.tar.gz |
bug SERVER-132 implemented pullAll/pushAll modifiers
Diffstat (limited to 'jstests/pullall.js')
-rw-r--r-- | jstests/pullall.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/pullall.js b/jstests/pullall.js new file mode 100644 index 00000000000..b720ce58204 --- /dev/null +++ b/jstests/pullall.js @@ -0,0 +1,18 @@ +t = db.jstests_pushall; +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 ); + |