fastapi / Python的MongoDB的异步ODM总体上

发布于 2025-02-11 18:27:53 字数 1553 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我为君王 2025-02-18 18:27:53

Beanie: https://beanie-odm.dev

首先,它是async(使用官方运动驱动程序,使用官方运动驱动程序,)如果您想使用 fastapi 的异步端点(大多数操作是I/O),则必须这是必须的。

Beanie允许我们在应用程序级别(使用Pydantic和Pydancticv2)定义模型并强制执行模式,并在FastAPI数据验证(都使用Pydantic)方面非常有用。

它还提供了与DB(例如Model.Intert(),model.get())进行交互的简单方法。

试一试! :)

Beanie: https://beanie-odm.dev

First, it is async (uses the official Motor driver), which is a must if you want to use async endpoints with FastAPI (most operations are I/O).

Beanie allows us to define models and enforce schemas at the application level (with Pydantic and PydancticV2) and works great with the FastAPI data validation (both are using Pydantic).

It also provides simple methods for interacting with the DB (e.g., model.insert(), model.get()).

Give it a shot ! :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文