diff options
Diffstat (limited to 'jstests/set4.js')
-rw-r--r-- | jstests/set4.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/set4.js b/jstests/set4.js new file mode 100644 index 0000000..b37366c --- /dev/null +++ b/jstests/set4.js @@ -0,0 +1,15 @@ + +t = db.set4; +t.drop(); + +orig = { _id:1 , a : [ { x : 1 } ]} +t.insert( orig ); + +t.update( {}, { $set : { 'a.0.x' : 2, 'foo.bar' : 3 } } ); +orig.a[0].x = 2; orig.foo = { bar : 3 } +assert.eq( orig , t.findOne() , "A" ); + +t.update( {}, { $set : { 'a.0.x' : 4, 'foo.bar' : 5 } } ); +orig.a[0].x = 4; orig.foo.bar = 5; +assert.eq( orig , t.findOne() , "B" ); + |