BeanieODM / beanie

Asynchronous Python ODM for MongoDB
http://beanie-odm.dev/
Apache License 2.0
1.94k stars 203 forks source link

Fix encoding keys in `Mapping` branch of `Encoder` #785

Closed Rubikoid closed 7 months ago

Rubikoid commented 8 months ago

Force every Mapping (dict, etc...) keys be string after encoding, because in other way mongo will throw bson.errors.InvalidDocument: documents must have only string keys, key was <key>.

This needs for normal encoding dicts like dict[uuid.UUID, datetime.datetime].

roman-right commented 7 months ago

Hi @Rubikoid ,

Thank you for the PR! Merged. Will be published soon