Using '.' in your key name in MongoDB (PyMongo)

When I try to save a dict with the character '.' in the PyMongo key throws an error (InvaildName), however I see (on the Mongodb website) that the keys may have. in them. Why does pymongo not allow me to save these documents? Is there a problem with them and with Mongo?

James

+4
source share
2 answers

Where you see an example of documents with "." in the key name? They are not valid in MongoDB (hence the limitation of PyMongo).

We believe that we use dot notation in queries for access within embedded documents.

+12
source

You can use the dot in updates and find, but not in save / insert.

+1
source

Source: https://habr.com/ru/post/1307833/


All Articles