2 ms·
In you article, you mentioned 'Dots are not allowed in BSON document keys. Typically it might not be a problem, but we had to work around it in our data migrati
by tszming 16y ago
In you article, you mentioned 'Dots are not allowed in BSON document keys. Typically it might not be a problem, but we had to work around it in our data migration.'
Do you have more information?
- mutru 16y agoIn 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.