odmantic icon indicating copy to clipboard operation
odmantic copied to clipboard

bson.errors.InvalidDocument: cannot encode object: frozenset()/set()

Open art049 opened this issue 4 years ago • 0 comments

Exception while saving an object containing either a frozenset or a set:

from odmantic import Model, AIOEngine
from odmantic.bson import ObjectId

class UserModel(Model):
    username: str
    favorites_article_ids: FrozenSet[ObjectId] = frozenset()

engine = AIOEngine()
await engine.save(UserModel(username="jean")) 

art049 avatar Oct 23 '20 00:10 art049