diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-03-31 09:29:41 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-03-31 09:29:41 -0400 |
commit | ded0dac9263f9205bbc2efe45537da49210e1c10 (patch) | |
tree | 418603b38276dc2b2831aa14afacf5fe9febfecc /jstests/push.js | |
parent | 9a397af854861484ebba3cfd6bbe92f7bbe7fb62 (diff) | |
download | mongo-ded0dac9263f9205bbc2efe45537da49210e1c10.tar.gz |
$pop from an empty fix SERVER-2465
Diffstat (limited to 'jstests/push.js')
-rw-r--r-- | jstests/push.js | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/jstests/push.js b/jstests/push.js index 2cdd91c35fe..9bcaa2ffb6b 100644 --- a/jstests/push.js +++ b/jstests/push.js @@ -17,6 +17,38 @@ assert.eq( "2" , t.findOne().a.toString() , "D" ); t.update( { _id : 2 } , { $push : { a : 3 } } ); t.update( { _id : 2 } , { $push : { a : 4 } } ); t.update( { _id : 2 } , { $push : { a : 5 } } ); -assert.eq( "2,3,4,5" , t.findOne().a.toString() , "D" ); +assert.eq( "2,3,4,5" , t.findOne().a.toString() , "E1" ); + +t.update( { _id : 2 } , { $pop : { a : -1 } } ); +assert.eq( "3,4,5" , t.findOne().a.toString() , "E2" ); + +t.update( { _id : 2 } , { $pop : { a : -1 } } ); +assert.eq( "4,5" , t.findOne().a.toString() , "E3" ); + t.update( { _id : 2 } , { $pop : { a : -1 } } ); -assert.eq( "3,4,5" , t.findOne().a.toString() , "D" ); +assert.isnull( db.getLastError() , "E4a" ) +assert.eq( "5" , t.findOne().a.toString() , "E4" ); + + +t.update( { _id : 2 } , { $pop : { a : -1 } } ); +assert.isnull( db.getLastError() , "E5a") +assert.eq( "" , t.findOne().a.toString() , "E5" ); + +t.update( { _id : 2 } , { $pop : { a : -1 } } ); +assert.isnull( db.getLastError() , "E6a" ) +assert.eq( "" , t.findOne().a.toString() , "E6" ); + +t.update( { _id : 2 } , { $pop : { a : -1 } } ); +assert.isnull( db.getLastError() , "E7a" ) +assert.eq( "" , t.findOne().a.toString() , "E7" ); + +t.update( { _id : 2 } , { $pop : { a : 1 } } ); +assert.isnull( db.getLastError() , "E8a" ) +assert.eq( "" , t.findOne().a.toString() , "E8" ); + +t.update( { _id : 2 } , { $pop : { b : -1 } } ); +assert.isnull( db.getLastError() , "E4a" ) + +t.update( { _id : 2 } , { $pop : { b : 1 } } ); +assert.isnull( db.getLastError() , "E4a" ) + |