--- id: marshmallow-mongoengine version: "0.31.2" license: MIT license_treatment: permissive maintenance: active --- # marshmallow-mongoengine — Mongoengine integration with the marshmallow (de)serialization library License: permissive · Maintenance: active · Downloads: 148.9K/mo ## What it is and what it does marshmallow-mongoengine bridges mongoengine (a MongoDB ODM for Python) and marshmallow (a serialization/deserialization library) by automatically generating marshmallow schemas from mongoengine document models. Instead of manually writing schema definitions, you declare your mongoengine models and then wrap them in a ModelSchema class that inherits the field structure automatically. This eliminates repetition when you need to serialize mongoengine documents to JSON, validate incoming data, or deserialize it back into document instances. The package handles the common workflow of MongoDB applications: define a mongoengine Document, create a corresponding schema, then use dump() to serialize instances and load() to deserialize and validate incoming data. It's particularly useful in REST APIs and other contexts where you need consistent validation and serialization of MongoDB documents without writing schema definitions twice. Use it for: - Building REST APIs backed by MongoDB that need automatic request/response serialization and validation - Converting mongoengine documents to JSON for API responses without manual field mapping - Validating incoming JSON data against mongoengine document structure before saving to MongoDB - Reducing boilerplate by auto-generating marshmallow schemas from existing mongoengine models - Handling nested document relationships (references, lists) in serialization workflows ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates marshmallow schemas automatically from mongoengine document models, enabling serialization and deserialization of MongoDB data with minimal boilerplate. Yes, if you're already using mongoengine and marshmallow together. The package eliminates schema duplication and integrates cleanly with both libraries. However, note that the last release was 2023-03-14; verify compatibility with your specific versions of mongoengine and marshmallow before adopting, and monitor the repository for any compatibility issues with newer releases of those dependencies. ## Install pip install marshmallow-mongoengine uv add marshmallow-mongoengine poetry add marshmallow-mongoengine ## Installing marshmallow-mongoengine Before you install: Low friction install with only two runtime dependencies (mongoengine and marshmallow). Repository is active with a recent commit on 2026-08-01, though the last release was 2023-03-14, indicating the package is stable but not under active development. License in practice: MIT licensed under a permissive license, allowing use in commercial and proprietary projects with minimal restrictions beyond attribution. Quickstart: pip install marshmallow-mongoengine import mongoengine as me from marshmallow_mongoengine import ModelSchema class Author(me.Document): name = me.StringField() class AuthorSchema(ModelSchema): class Meta: model = Author author_schema = AuthorSchema() author = Author(name='Test').save() dump_data = author_schema.dump(author).data Verify before relying: - Whether the package supports mongoengine versions released after 2023-03-14 - Compatibility with modern marshmallow versions and any breaking changes in recent releases - Whether Python 3.9+ is supported despite classifiers only listing through 3.8 ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 148.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags mongoengine marshmallow integration, serialize mongoengine documents, mongodb schema validation, mongoengine to json serialization, marshmallow mongoengine schemas, document serialization mongodb, mongodb-serialization, schema-generation [View on SkillFed](https://skillfed.io/packages/marshmallow-mongoengine) · [View on PyPI](https://pypi.org/project/marshmallow-mongoengine/)