diff options
Diffstat (limited to 'jstests/updatek.js')
| -rw-r--r-- | jstests/updatek.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/updatek.js b/jstests/updatek.js new file mode 100644 index 00000000000..0c6c848ab16 --- /dev/null +++ b/jstests/updatek.js @@ -0,0 +1,16 @@ +// Test modifier operations on numerically equivalent string field names. SERVER-4776 + +t = db.jstests_updatek; + +t.drop(); +t.save( { _id:0, '1':{}, '01':{} } ); +t.update( {}, { $set:{ '1.b':1, '1.c':2 } } ); +// make sure correct fields are set, with no duplicates +// must use string comparison because V8 reorders fields that are numerical in objects +assert.eq( "{ \"01\" : { }, \"1\" : { \"b\" : 1, \"c\" : 2 }, \"_id\" : 0 }", tojson(t.findOne()) ); + +t.drop(); +t.save( { _id:0, '1':{}, '01':{} } ); +t.update( {}, { $set:{ '1.b':1, '01.c':2 } } ); +assert.eq( "{ \"01\" : { \"c\" : 2 }, \"1\" : { \"b\" : 1 }, \"_id\" : 0 }", tojson(t.findOne()) ); + |
