Skip to main content
Travis-CI Documentation Status Code Coverage

marshmallow-mongoengine

Mongoengine integration with the marshmallow (de)serialization library.

See documentation at http://marshmallow-mongoengine.rtfd.org/

Declare your models

import mongoengine as me

class Author(me.Document):
    id = me.IntField(primary_key=True, default=1)
    name = me.StringField()
    books = me.ListField(me.ReferenceField('Book'))

    def __repr__(self):
        return '<Author(name={self.name!r})>'.format(self=self)


class Book(me.Document):
    title = me.StringField()

Generate marshmallow schemas

from marshmallow_mongoengine import ModelSchema

class AuthorSchema(ModelSchema):
    class Meta:
        model = Author

class BookSchema(ModelSchema):
    class Meta:
        model = Book

author_schema = AuthorSchema()

(De)serialize your data

author = Author(name='Chuck Paluhniuk').save()
book = Book(title='Fight Club', author=author).save()

dump_data = author_schema.dump(author).data
# {'id': 1, 'name': 'Chuck Paluhniuk', 'books': ['5578726b7a58012298a5a7e2']}

author_schema.load(dump_data).data
# <Author(name='Chuck Paluhniuk')>

Get it now

pip install -U marshmallow-mongoengine

License

MIT licensed. See the bundled LICENSE file for more details.

Release files for marshmallow-mongoengine 0.31.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marshmallow-mongoengine 0.31.2
File Size Uploaded
marshmallow-mongoengine-0.31.2.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for marshmallow-mongoengine 0.31.2
File Interpreter ABI Platform
marshmallow_mongoengine-0.31.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 23.6 kB

Release files / marshmallow-mongoengine-0.31.2.tar.gz

Download URL marshmallow-mongoengine-0.31.2.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a708732456e1a36139c6ce52910b57cf2a54e7206c5c635a48dba9e3e157d6db
BLAKE2b-256 checksum
How to use checksums
63725cabacd62c5b4f81a1e955e0c54bb86d1289621e384f522552806f9ee101
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / marshmallow_mongoengine-0.31.2-py2.py3-none-any.whl

Download URL marshmallow_mongoengine-0.31.2-py2.py3-none-any.whl
Size 12.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
51de7614ce9002f9f679aebb6df7488297e791fbd07d9f14b963e9c7bce604ca
BLAKE2b-256 checksum
How to use checksums
c4efec8be29d7f6dec0bae9391e8fae352a3d5b2ddb9be84a7d611a5b0e5c1de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.31.2 This release

2 release files

0.31.1

2 release files

0.31.0

2 release files

0.30.2

1 release file

0.30.1

1 release file

0.30.0

1 release file

0.11.0

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.0

1 release file

0.7.9

1 release file

0.7.8

1 release file

0.7.7

1 release file

0.7.6

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

2 release files

0.7.0

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page