-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
Steps to reproduce:
> db.test.foo.insert({"a":
{"c0":1}, 'c':2})
> db.test.foo.find(
)
{ "_id" : ObjectId("4def775276aed51aaa0684d3"), "a" :
, "c" : 2 }
> db.test.foo.update(
, {'$inc':{'a.b0':1}})
> db.test.foo.find(
)
// So far, so good
{ "_id" : ObjectId("4def775276aed51aaa0684d3"), "a" :
, "c" : 2 }
//Things go off the rails. This should add a new field, 'c00'
> db.test.foo.update(
, {'$inc':{'a.c00':1}})
> db.test.foo.find(
)
// Notice the 'c0' key has been changed to 'c00'. This should have added a new field.
{ "_id" : ObjectId("4def775276aed51aaa0684d3"), "a" :
, "c" : 2 }
// This works as expected.
> db.test.foo.update(
, {'$inc':{'a.cc':1}})
> db.test.foo.find(
)
{ "_id" : ObjectId("4def775276aed51aaa0684d3"), "a" :
, "c" : 2 }
>