diff options
-rw-r--r-- | jstests/set1.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/set1.js b/jstests/set1.js new file mode 100644 index 00000000000..f1dc64328ed --- /dev/null +++ b/jstests/set1.js @@ -0,0 +1,16 @@ + +t = db.set1; +t.drop(); + +t.insert( { _id : 1, emb : {} }); + +t.update( { _id : 1 }, { $set : { emb : { 'a.dot' : 'data'} }}); +assert.eq( 1 , t.findOne().emb.keySet().length , "A" ); +assert.eq( "a.dot" , t.findOne().emb.keySet()[0] , "B" ); + +t.update( { _id : 1 }, { $set : { 'emb.b' : { dot : 'data'} }}); +assert.eq( 2 , t.findOne().emb.keySet().length , "C" ); +//assert.eq( "a.dot" , t.findOne().emb.keySet()[0] , "D" ); +//assert.eq( "b" , t.findOne().emb.keySet()[0] , "E" ); + + |