# BeanieODM/beanie

Asynchronous Python ODM for MongoDB

Repository: https://github.com/BeanieODM/beanie
Canonical: https://ross.abutalabs.com/products/beanie
Homepage: http://beanie-odm.dev/
Language: Python
License: Apache-2.0
License Family: permissive
Topics: mongodb, pydantic, asynchronous, asyncio, motor, beanie, mongo, async, python, orm, odm, pymongo
Last push: 2026-08-24T19:58:56+00:00

## Health v2 (maintenance only)
Score: 83/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 53, longevity 100
- inputs: {"age_days": 2017, "days_push": 9, "days_rel": 159, "gap_med": 92.5, "n_releases_24m": 7}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2695, forks 306 (observed 2026-08-28T04:07:11.175215+00:00)

## What it is
Beanie is an asynchronous Python object-document mapper (ODM) for MongoDB, with data models built on Pydantic. Each MongoDB collection maps to a Document class supporting CRUD, pythonic queries, aggregations, indexes, and built-in data and schema migrations.

## Use cases
- map MongoDB collections to typed Pydantic models in Python
- query MongoDB with pythonic expressions like Product.price < 10
- run async MongoDB CRUD in FastAPI or asyncio apps
- manage MongoDB schema and data migrations
- define indexes declaratively on document fields
- build aggregation pipelines with typed projections

## When to choose
- you use MongoDB with async Python (e.g. FastAPI) and want Pydantic-based models
- you want an ODM with migrations, indexes, and relations out of the box
- you prefer typed, pythonic query syntax over raw pymongo dicts

## When to avoid
- you need a synchronous ODM (use Bunnet instead)
- you use a relational database or SQL-based ORM
- you rely on Pydantic v1 or very old MongoDB/Python versions

## Facets
- artifact type: library
- maturity: active
- function: orm, database-driver, database
- domain: databases, backend, web-development, developer-tools
- platform: python, cross-platform
- tags: mongodb, odm, pydantic, asyncio, motor, pymongo, schema-migrations

## Member repositories
- BeanieODM/beanie (main) score 83

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:11.175215+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:16:19.027630+00:00, confidence not recorded.
  - readme: https://github.com/BeanieODM/beanie (fetched 2026-08-28T04:07:11.175215+00:00, sha e21b6802a4bf)
  - homepage: http://beanie-odm.dev/ (fetched 2026-08-29T09:59:34.768857+00:00, sha aa503d94a368)
  - site_page: http://beanie-odm.dev/getting-started (fetched 2026-08-29T09:59:34.771400+00:00, sha ca00c4a18d69)
  - site_page: http://beanie-odm.dev/api-documentation/document (fetched 2026-08-29T09:59:34.773086+00:00, sha e2acb981244e)
  - site_page: http://beanie-odm.dev/api-documentation/query (fetched 2026-08-29T09:59:34.775124+00:00, sha 1069689a5019)
  - site_page: http://beanie-odm.dev/api-documentation/interfaces (fetched 2026-08-29T09:59:34.777155+00:00, sha fffce28e37a1)
  - site_page: http://beanie-odm.dev/api-documentation/operators/find (fetched 2026-08-29T09:59:34.779070+00:00, sha d9e46a4d137c)
  - site_page: http://beanie-odm.dev/api-documentation/operators/update (fetched 2026-08-29T09:59:34.780922+00:00, sha 506f1af6fcaf)
  - site_page: http://beanie-odm.dev/api-documentation/fields (fetched 2026-08-29T09:59:34.782561+00:00, sha 9cd7b15a1017)
  - registry_pypi: https://pypi.org/pypi/beanie/json (fetched 2026-08-29T09:59:34.786561+00:00, sha 560b1f40a395)
- Data as of 2026-08-30T08:39:29.467469+00:00.
