summaryrefslogtreecommitdiff
path: root/jstests/push.js
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-09-14 17:08:06 +0200
committerAntonin Kral <a.kral@bobek.cz>2011-09-14 17:08:06 +0200
commit5d342a758c6095b4d30aba0750b54f13b8916f51 (patch)
tree762e9aa84781f5e3b96db2c02d356c29cf0217c0 /jstests/push.js
parentcbe2d992e9cd1ea66af9fa91df006106775d3073 (diff)
downloadmongodb-5d342a758c6095b4d30aba0750b54f13b8916f51.tar.gz
Imported Upstream version 2.0.0
Diffstat (limited to 'jstests/push.js')
-rw-r--r--jstests/push.js36
1 files changed, 34 insertions, 2 deletions
diff --git a/jstests/push.js b/jstests/push.js
index 2cdd91c..9bcaa2f 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" )
+