summaryrefslogtreecommitdiff
path: root/jstests/set2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/set2.js')
-rw-r--r--jstests/set2.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/set2.js b/jstests/set2.js
new file mode 100644
index 00000000000..221ee407759
--- /dev/null
+++ b/jstests/set2.js
@@ -0,0 +1,18 @@
+
+t = db.set2;
+t.drop();
+
+t.save( { _id : 1 , x : true , y : { x : true } } );
+assert.eq( true , t.findOne().x );
+
+t.update( { _id : 1 } , { $set : { x : 17 } } );
+assert.eq( 17 , t.findOne().x );
+
+assert.eq( true , t.findOne().y.x );
+t.update( { _id : 1 } , { $set : { "y.x" : 17 } } );
+assert.eq( 17 , t.findOne().y.x );
+
+t.update( { _id : 1 } , { $set : { a : 2 , b : 3 } } );
+assert.eq( 2 , t.findOne().a );
+assert.eq( 3 , t.findOne().b );
+