odmantic模型从pydantic模型继承
您好,亲爱的社区,
我正在与MongoDB操作的Engine合作,并且有一个从Pydantic模型继承的Odmantic模型。
OdmanticModel(Model, PydanticModel):
attributes
Odmantic模型似乎没有考虑Pydantic模型属性,并且最终并未保存在MongoDB中。 是否有任何解决方案或工具使继承完全隐含或明确地工作
Hello dear community,
I am working with engine for mongodb operations and i have an odmantic model that inherit from a pydantic model.
OdmanticModel(Model, PydanticModel):
attributes
It seems that odmantic model does not considerate pydantic model attribute, and these are not saved eventually in mongodb.
Is there any solution or a workarround to make the inheritance fully worked implicitly or explicitly
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为解决方案的替代方案,我使用了Beanie ODM,当涉及Pydantic和MongoDB模型相互作用时,它是完美的。
beanie-是基于电机和pydantic的蒙古德(Mongodb)的异步Python对象图案映射器(ODM)。
As an alternative for the solution, i used Beanie ODM, it is perfect when it comes to pydantic and mongodb models interactions.
Beanie - is an Asynchronous Python object-document mapper (ODM) for MongoDB, based on Motor and Pydantic.