3 ms·
In MongoDB this is not possible: > db.test.insert({"foo.bar": 1}); Mon Jul 26 14:24:39 JS Error: uncaught exception: can't have . in field names [foo.bar] Aft
by mutru 16y ago
In MongoDB this is not possible:
> db.test.insert({"foo.bar": 1});
Mon Jul 26 14:24:39 JS Error: uncaught exception: can't have . in field names [foo.bar]
After all that's only natural, because the dot notation is supported in queries.
For example, consider storing an e-mail in MongoDB:
{
content: "<p>HTML mail. <img src="cid:1234.0" alt="from attachment"/></p>",
attachments: {
"1234.0": { some details about the attachment }
}
}
This is not legal, but in this case it's of course easy to work around (have attachments in an array and have the CID as a value instead of a key).
- tszming 16y agoThanks, this is interesting.