beanie
Asynchronous Python ODM for MongoDB
Decision gist · record as of 2026-08-14
Yes. Beanie is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It's a solid choice if you're building async Python applications with MongoDB and want type-safe, Pydantic-based data models. The main constraint is that you must be using async/await and have MongoDB available; if you need synchronous access, the project maintains a separate package called Bunnet.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires MongoDB server running and accessible; async/await syntax requires Python 3.10 or later.
- Low friction installation with a pure-Python wheel.
- Actively maintained as of 2026-08-10 with recent release history.
License · maintenance · safety
permissive license (permissive) — Licensed under Apache Software License (permissive), so you can use it freely in commercial and open-source projects without copyleft obligations.
last release 2026-08-07 (7 days) · last repo commit 2026-08-10 · 2,690 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,710,548 downloads/mo, #3,625 on PyPI
Alternatives
Verify before relying
pip install beanie
import asyncio
from pymongo import AsyncMongoClient
from beanie import Document, init_beanie
class Product(Document):
name: str
price: float
async def main():
client = AsyncMongoClient("mongodb://localhost:27017")
await init_beanie(database=client.db_name, document_models=[Product])
product = await Product.find_one(Product.price < 10)
asyncio.run(main())- Whether schema migrations are automatic or require manual setup steps.
- Performance characteristics compared to raw pymongo for large datasets.
- Whether the Indexed() syntax supports all MongoDB index types.
What it is and what it does
Beanie is an asynchronous ODM (object-document mapper) that sits on top of PyMongo and Pydantic, letting you define MongoDB collections as Python classes with type hints and validation. Instead of writing raw MongoDB queries, you work with Document subclasses that map to collections, and Beanie handles the serialization, validation, and async I/O for you.
It's designed to reduce boilerplate when building async Python applications that use MongoDB—particularly useful in FastAPI projects or other async frameworks. You define a Document class with Pydantic fields, initialize Beanie with your MongoDB client, and then use methods like insert(), find_one(), and set() on your document instances. The package handles data migrations and index definitions declaratively.
Use it for
- Building FastAPI REST APIs backed by MongoDB with async request handlers and Pydantic validation.
- Defining MongoDB schemas as Python classes to enforce type safety and validation across your application.
- Querying MongoDB collections using Python syntax (e.g., Product.price < 10) instead of raw MongoDB query dictionaries.
- Managing document relationships and nested Pydantic models within MongoDB documents.
- Handling database migrations and index creation declaratively as part of your Document class definitions.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Beanie is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It's a solid choice if you're building async Python applications with MongoDB and want type-safe, Pydantic-based data models. The main constraint is that you must be using async/await and have MongoDB available; if you need synchronous access, the project maintains a separate package called Bunnet.
Install
beanie on PyPI
Before you install
Low friction installation with a pure-Python wheel. Actively maintained as of 2026-08-10 with recent release history. Depends on pydantic, pymongo, click, lazy-model, and typing-extensions—all stable, widely-used packages.
Requires MongoDB server running and accessible; async/await syntax requires Python 3.10 or later.
License in practice
Licensed under Apache Software License (permissive), so you can use it freely in commercial and open-source projects without copyleft obligations.
Quickstart
pip install beanie
import asyncio
from pymongo import AsyncMongoClient
from beanie import Document, init_beanie
class Product(Document):
name: str
price: float
async def main():
client = AsyncMongoClient("mongodb://localhost:27017")
await init_beanie(database=client.db_name, document_models=[Product])
product = await Product.find_one(Product.price < 10)
asyncio.run(main())
Verify before relying
- Whether schema migrations are automatic or require manual setup steps.
- Performance characteristics compared to raw pymongo for large datasets.
- Whether the Indexed() syntax supports all MongoDB index types.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release <3.14,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagespydanticclicklazy-modelpymongotyping-extensions |
| Maintenance | Actively maintained 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,710,548 / month, #3,625 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: DatabaseTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: beanie-2.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “mongodb async odm python”
- beanieBeanie is an asynchronous Python object-document mapper for MongoDB…
- odmanticODMantic is an async-first Object Document Mapper for MongoDB that…
- mongoengineMongoEngine provides an Object-Document Mapper (ODM) layer on top of…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also mongoengine · odmantic · pydantic-mongo · Flask-PyMongo · pymongo · motor · pymongoexplain · pymongoarrow · pymongo_inmemory · dyntastic