Permalink
Browse files

test $where in updates

  • Loading branch information...
1 parent 08cf896 commit 62a5882e24d1ff5d8f70854f03b78f0ee8fac6d6 @erh erh committed May 30, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 jstests/where4.js
View
@@ -0,0 +1,16 @@
+
+db.where4.drop();
+
+db.system.js.insert( { _id : "w4" , value : "5" } )
+
+db.where4.insert( { x : 1 , y : 1 } )
+db.where4.insert( { x : 2 , y : 1 } )
+
+db.where4.update( { $where : function() { return this.x == 1; } } ,
+ { $inc : { y : 1 } } , false , true );
+
+
+assert.eq( 2 , db.where4.findOne( { x : 1 } ).y )
+assert.eq( 1 , db.where4.findOne( { x : 2 } ).y )
+
+db.system.js.remove( { _id : "w4" } )

0 comments on commit 62a5882

Please sign in to comment.