This kind of document are not accepted by Mongodb:
{\'.\':1}
if encode and decode by hand that\'s a pain. Any thoughts?
The Naming Restrictions on database, collection, and field names have practical purposes. They try to ensure queries are unambiguous and that valid filenames can be created.
For example:
MongoDB uses dot notation to access elements of an array or subdocument.
MongoDB uses the dollar sign ($) to represent operators (eg. $inc
).
Database names correspond to files created in the operating system, and there are reserved characters for path separators and wildcards.
The obvious workaround (which is also suggested in the MongoDB manual) is to use a different character. For example, the Unicode full width equivalents of $
and .
will display similarly but are not reserved: