Motor-ODM 0.1 Documentation


Motor-ODM is a modern async Object-Document-Mapper for MongoDB. It is based on Pydantic and Motor. It exclusively works with asyncio.

Using ObjectId

If you are using Pydantic for more than your ODM (e.g. when using FastAPI and want to use the bson.ObjectId class you need to tell Pydantic how to handle this class. You can either do this manually or use the handlers from Motor-ODM. To do so all you need to do is make sure that motor_odm.document is imported before you define your Pydantic models that use ObjectId.


Motor-ODM consists of several modules and classes all of which are documented in the full API reference. This section highlights some classes in order to give you an overview where to start.


This is the base class for all documents defined using Motor-ODM.


Creates a MongoDB query from the specified arguments.