Right now, if you want to store reference to another document, you should create something like this:
class Foo(DBPydanticMixin):
names: List[str]
class Config:
database = 'default'
collection = 'foo'
class MetaInfo(BaseDBMixin):
flag: bool = True
count: int = 0
foo: Optional[Foo] = None
class Bar(DBPydanticMixin):
name: str
meta: MetaInfo = MetaInfo()
class Config:
database = 'default'
collection = 'bar'
But when you tried to save new Foo in field foo of Embedded model MetaInfo in Bar model you will faced with the fact, that Foo will be saved as separated document in foo collection and also will be duplicated as field of MetaInfo.
Right now, if you want to store reference to another document, you should create something like this:
But when you tried to save new
Foo
in fieldfoo
ofEmbedded
modelMetaInfo
inBar
model you will faced with the fact, thatFoo
will be saved as separated document infoo
collection and also will be duplicated as field ofMetaInfo
.