====================== μMongo: sync/async ODM ====================== .. image:: :target: .. image:: :target: .. image:: :target: :alt: Documentation Status .. image:: :target: :alt: Code coverage μMongo is a Python MongoDB ODM. It inception comes from two needs: the lack of async ODM and the difficulty to do document (un)serialization with existing ODMs. From this point, μMongo made a few design choices: - Stay close to the standards MongoDB driver to keep the same API when possible: use ``find({"field": "value"})`` like usual but retrieve your data nicely OO wrapped ! - Work with multiple drivers (PyMongo_, TxMongo_, motor_asyncio_ and mongomock_ for the moment) - Tight integration with Marshmallow_ serialization library to easily dump and load your data with the outside world - Free software: MIT license - Test with 90%+ coverage ;-) .. _PyMongo: .. _TxMongo: .. _motor_asyncio: .. _mongomock: .. _Marshmallow: Quick example .. code-block:: python from datetime import datetime from pymongo import MongoClient from umongo import Document, fields, validate db = MongoClient().test class User(Document): email = fields.EmailField(required=True, unique=True) birthday = fields.DateTimeField(validate=validate.Range(min=datetime(1900, 1, 1))) friends = fields.ListField(fields.ReferenceField("User")) class Meta: collection = db.user goku = User(email='', birthday=datetime(1984, 11, 20)) goku.commit() vegeta = User(email='', friends=[goku]) vegeta.commit() vegeta.friends # [ObjectId('570ddb311d41c89cabceeddb')] vegeta.dump() # {id': '570ddb311d41c89cabceeddc', 'email': '', friends': ['570ddb2a1d41c89cabceeddb']} User.find_one({"email": ''}) # <object Document __main__.User({'_id': ObjectId('570ddb2a1d41c89cabceeddb'), 'friends': <object umongo.data_objects.List([])>, # 'email': '', 'birthday': datetime.datetime(1984, 11, 20, 0, 0)})> Get it now:: $ pip install umongo


Project Slug


Last Built

1 year, 9 months ago passed


Home Page



asyncio, mongodb, odm, python3, twisted

Short URLs

Default Version


'latest' Version