Situation: some MongoDB documents have subdocuments that contain an empty key, e.g. (I stripped ObjectIDs to make the code look nicer):
{ "_id" : ObjectId("..."), "stats" : { "violations" : 0, "cost" : 170, }, "parameters" : { "" : "../instances/comp/comp20.ectt", "repetition" : 29, "time" : 600000 }, "batch" : ObjectId("..."), "system" : "Linux 3.5.0-27-generic", "host" : "host3", "date_started" : ISODate("2013-05-14T16:46:46.788Z"), "date_stopped" : ISODate("2013-05-14T16:56:48.483Z"), "copy" : false }
The problem is line:
"" : "../instances/comp/comp20.ectt"
it is impossible to get back the value of the field. Querying doesn't work:
db.experiments.find(
{"batch": ObjectId("...")},
{ "parameters.": 1 })
gets the full content of the parameters subdocument. (My guess is that "." is probably ignored if followed by an empty selector.) From the JSON specification (15.12.*) it looks like empty keys are allowed.
Moreover, renaming doesn't work either, for similar reasons.
- duplicates
-
SERVER-6852 Disallow empty path components in documents and queries
- Backlog