r/PythonProjects2 • u/wailgrtili • May 26 '26
need to use odm for mongo db in python
I built a type-safe MongoDB ODM on top of Pydantic v2 (and it got interesting)
I’ve been working on a MongoDB ODM in Python with:
fully typed models (Pydantic v2)
query DSL (
User.age > 18)FieldRefsystem (User.name)lifecycle hooks (
before_insert,after_insert)index definitions inside models
Motor async backend
The goal: make MongoDB feel like a typed query system, not raw dicts.
6
Upvotes