Description
Release notes say: "Starting in MongoDB version 2.5.4, update operations no longer supports saving field names that contain a dot (.) or a field name that starts with a dollar sign ($)."
There is a case where update still saves a field name with a dot (.).
The steps:
> db.test.drop()
|
true
|
|
> db.test.update({y : {"bad.1" : 1}}, {$setOnInsert : {x : 42}}, {upsert : true})
|
WriteResult({
|
"nMatched" : 0,
|
"nUpserted" : 1,
|
"nModified" : 0,
|
"_id" : ObjectId("530a79b4f0b65d96ef21598a")
|
})
|
|
> db.test.find()
|
{ "_id" : ObjectId("530a79b4f0b65d96ef21598a"), "y" : { "bad.1" : 1 }, "x" : 42 }
|
As a result, we have a new document which has a nested document with the element name with a dot: "bad.1".