I have a mongoengine.Document subclass User Defined.
class User(Document):
meta = {'collection': 'users', 'allow_inheritance': False}
_id = ObjectIdField()
password = StringField(max_length=50)
name = StringField(max_length=50, required
now I want to use it as a separate document with my own collection, but I want to also use it as an EmbeddedDocument as part of a game entry:
class Game(Document):
meta = {'collection': 'games', 'allow_inheritance': False}
_id = ObjectIdField()
name = StringField()
owner = EmbeddedField(User)
but there's a problem. Mongoengine allows you to embed only subclasses of EmbeddedDocument. Is there any way to solve this problem?
source
share