MongoEngine maps Python classes to MongoDB documents on top of PyMongo. It supports typed fields, queries, inheritance, and optional Django integration.
Overview
MongoEngine is a Python Object-Document Mapper for working with MongoDB. It sits above PyMongo so applications define Document classes with declared fields, then create, query, and update records through a Django-like API.
Models can use strings, datetimes, lists, references, and specialized field types, including document inheritance patterns. Querysets support filtering, counting, and iteration across base and subclass types. Optional extras add date parsing via python-dateutil, image fields via Pillow, and signals via blinker.
The library is installed from PyPI and requires a supported Python release and compatible MongoDB server versions. Official documentation is hosted on Read the Docs, with a tutorial, user guide, and API reference. Community support is available through mailing lists and Stack Overflow.
Key features
- Document classes with typed fields
- Querysets and inheritance
- PyMongo-based connectivity
- Optional image and signal fields
- Django usage guidance
- Tutorial and API documentation
Use cases
- Modeling MongoDB data in Python
- Blog or content document stores
- Prototyping document schemas