summaryrefslogtreecommitdiff
path: root/jstests/where4.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-05-30 11:59:58 -0400
committerEliot Horowitz <eliot@10gen.com>2012-05-30 11:59:58 -0400
commit62a5882e24d1ff5d8f70854f03b78f0ee8fac6d6 (patch)
treedb4b99ac82685a15fbbafd9f21f05e21197c6f4b /jstests/where4.js
parent08cf8964c3bb095d9f4114157bdf456c195ed510 (diff)
downloadmongo-62a5882e24d1ff5d8f70854f03b78f0ee8fac6d6.tar.gz
test $where in updates
Diffstat (limited to 'jstests/where4.js')
-rw-r--r--jstests/where4.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/where4.js b/jstests/where4.js
new file mode 100644
index 00000000000..9989aa755b3
--- /dev/null
+++ b/jstests/where4.js
@@ -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" } )