mongoengine
MongoEngine is a Python Object-Document Mapper for working with MongoDB.
Decision gist · record as of 2026-08-14
Yes. MongoEngine is production-stable, actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. Install it if you want an ORM-like layer over MongoDB and prefer working with Python classes and typed fields instead of raw dictionaries and queries. Skip it only if you need maximum performance or prefer the flexibility and control of raw PyMongo.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a running MongoDB instance (local or remote) to connect to; MongoEngine is tested against MongoDB v4.4, v5.0, v6.0, and v7.0.
- Low friction: pure Python wheel, single runtime dependency (pymongo), and active maintenance with a recent release (157 days ago) and ongoing repository activity.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use MongoEngine in commercial and proprietary projects with minimal restrictions.
last release 2026-03-10 (157 days) · last repo commit 2026-06-23 · 4,348 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,512,474 downloads/mo, #3,032 on PyPI
Alternatives
Verify before relying
pip install mongoengine
from mongoengine import Document, StringField, connect
connect('mydb')
class BlogPost(Document):
title = StringField(required=True, max_length=200)
post = BlogPost(title='Example')
post.save()- Whether optional dependencies (dateutil, Pillow, blinker) are automatically installed or must be added separately for their respective features.
- Performance characteristics and query optimization strategies compared to raw PyMongo for large datasets.
What it is and what it does
MongoEngine is a Python Object-Document Mapper that sits on top of PyMongo and lets you define MongoDB documents as Python classes with typed fields, validation rules, and relationships. Instead of working directly with dictionaries and raw MongoDB queries, you define a class (like a Django model or SQLAlchemy ORM class) with fields like StringField, DateTimeField, and ListField, then create, query, and manipulate documents as instances of those classes. It handles the translation between Python objects and MongoDB's BSON format, supports inheritance, field validation, and provides a query interface similar to traditional ORMs.
The package is production-stable, actively maintained, and widely used. It depends only on pymongo and has low install friction. Optional features like DateTimeField parsing, image handling, and signal support require additional packages (dateutil, Pillow, blinker) that you can add as needed. MongoEngine is tested against MongoDB v4.4, v5.0, v6.0, and v7.0, and supports Python 3.7 and later.
Use it for
- Define MongoDB schemas with typed fields and validation rules, then query documents as Python objects instead of raw dictionaries.
- Build web applications (Flask, Django) that need MongoDB persistence with an ORM-like interface familiar to SQL developers.
- Implement document inheritance and polymorphism where subclasses of a base document type are stored in the same collection.
- Prototype or migrate from SQL databases to MongoDB while keeping a similar object-oriented data model.
- Handle complex nested documents and lists with automatic serialization and deserialization between Python and BSON.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
MongoEngine is production-stable, actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. Install it if you want an ORM-like layer over MongoDB and prefer working with Python classes and typed fields instead of raw dictionaries and queries. Skip it only if you need maximum performance or prefer the flexibility and control of raw PyMongo.
Install
mongoengine on PyPI
Before you install
Low friction: pure Python wheel, single runtime dependency (pymongo), and active maintenance with a recent release (157 days ago) and ongoing repository activity.
Requires a running MongoDB instance (local or remote) to connect to; MongoEngine is tested against MongoDB v4.4, v5.0, v6.0, and v7.0.
License in practice
MIT license is permissive; you can use MongoEngine in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install mongoengine
from mongoengine import Document, StringField, connect
connect('mydb')
class BlogPost(Document):
title = StringField(required=True, max_length=200)
post = BlogPost(title='Example')
post.save()
Verify before relying
- Whether optional dependencies (dateutil, Pillow, blinker) are automatically installed or must be added separately for their respective features.
- Performance characteristics and query optimization strategies compared to raw PyMongo for large datasets.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepymongo |
| Maintenance | Actively maintained 157 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,512,474 / month, #3,032 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 :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: DatabaseTopic :: Software Development :: Libraries :: Python Modules |
Evidence: mongoengine-0.29.3-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 orm python”
- mongoengineMongoEngine provides an Object-Document Mapper (ODM) layer on top of…
- djongoDjongo translates Django ORM queries into MongoDB queries, allowing…
- beanieBeanie is an asynchronous Python object-document mapper for MongoDB…
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 beanie · flask-mongoengine · odmantic · marshmallow-mongoengine · Flask-PyMongo · pydantic-mongo · pymongoarrow · pymongo · pymongoexplain · CouchDB