| Steps To Reproduce: |
To get a nameless property from shell:
db.testGuy.insert({Name: "Test1"})
|
db.testGuy.update({Name: "Test1"}, {$inc: {"TestObject..Value": 1}})
|
db.testGuy.findOne({Name: "Test1"})
|
{
|
"Name" : "Test1",
|
"TestObject" : {
|
"" : {
|
"Value" : 1
|
}
|
},
|
"_id" : ObjectId("52f93e1be856377627267033")
|
}
|
Yikes! Now what happens if I try to mess around with TestObject?
db.testGuy.update({Name: "Test1"}, {$inc: "TestObject.TestProperty.Value": 1}})
|
db.testGuy.findOne({Name: "Test1"})
|
{
|
"Name" : "Test1",
|
"TestObject" : {
|
"" : {
|
"Value" : 1
|
}
|
},
|
"_id" : ObjectId("52f93e1be856377627267033")
|
}
|
db.testGuy.update({Name: "Test1"}, {$inc: {VeryCoolValue: 1, "TestObject.AnotherValue": 1}})
|
{
|
"Name" : "Test1",
|
"TestObject" : {
|
"" : {
|
"Value" : 1
|
}
|
},
|
"VeryCoolValue" : 1,
|
"_id" : ObjectId("52f93e1be856377627267033")
|
}
|
That last one shows the danger of this kind of situation: the updates partially complete and report success even though half of my update actually failed.
|