|
There seems to be some more awkward situations you can get yourself into via updates:
> db.test.insert({"_subdoc_" : {"id" : 12345, " " : "space", "" : "empty"}})
|
> db.test.find()
|
{ "_id" : ObjectId("506dbb9cdce13c926d098435"), "_subdoc_" : { "id" : 12345, " " : "space", "" : "empty" } }
|
> db.test.update({"_subdoc_.id" : 12345}, {"$rename" : {"_subdoc_." : "_subdoc_.empty'"}});
|
Invalid mod field name, may not end in a period
|
> db.test.update({"_subdoc_.id" : 12345}, {"$unset" : {"_subdoc_." : 1}});
|
Invalid mod field name, may not end in a period
|
> db.test.update({"_subdoc_.id" : 12345}, {"$set" : {"_subdoc_." : 1}});
|
Invalid mod field name, may not end in a period
|
> giveUp();
|
Thu Oct 4 09:41:27 ReferenceError: giveUp is not defined (shell):1
|
Overall, I think both insert and update field name validation is somewhat lacking. I am wrapping MongoDB and am finding all sorts of edge cases which I need to catch to prevent people from getting themselves into situations like these.
Coincidentally, I cannot find a source document which describes exactly what is or isn't allowed for field names.
|