diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-05-30 11:59:58 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-05-30 11:59:58 -0400 |
commit | 62a5882e24d1ff5d8f70854f03b78f0ee8fac6d6 (patch) | |
tree | db4b99ac82685a15fbbafd9f21f05e21197c6f4b /jstests | |
parent | 08cf8964c3bb095d9f4114157bdf456c195ed510 (diff) | |
download | mongo-62a5882e24d1ff5d8f70854f03b78f0ee8fac6d6.tar.gz |
test $where in updates
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/where4.js | 16 |
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" } ) |