无法从FastApi用户和无檐小便帽中的相关文档中获得结果
我有几个型号:
class Message(Document):
phone: str
message_body: str
user: Indexed(PydanticObjectId)
class Settings:
name = "Message"
class User(BeanieBaseUser[PydanticObjectId]):
messages: Optional[List[Link[Message]]]
他们使用豆豆链接有关系。 消息模型是自定义模型,用户是FastApi用户的默认模型。
当我将insert()保存在子模型的消息上时,它不会与父母建立关系。使用NULL消息字段返回DICT。 知道有什么错误?
I have a couple of models:
class Message(Document):
phone: str
message_body: str
user: Indexed(PydanticObjectId)
class Settings:
name = "Message"
class User(BeanieBaseUser[PydanticObjectId]):
messages: Optional[List[Link[Message]]]
They have a relationship using Beanie Link.
The Message model is a custom Model and User is the default of FastAPI-Users.
When I save a record with insert() on a Message that is the child model, it does not establish a relationship with the parent. Returning the dict with null messages field.
Any idea what could be the error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是使用
fetch_link
结帐FastApi-Users Creator的响应
https://github.com/github.com/github.com/fastapapi-users/fastapi-users/fastapi-users/fastapi-user用户/讨论/1006#讨论-4101669
One way to do this is with
fetch_link
Checkout the response from FastAPI-Users creator
https://github.com/fastapi-users/fastapi-users/discussions/1006#discussion-4101669