Mongo ODM for Python
Project description
MongoMapper
Mongo ODM in Python.
MongoMapper is an easy to use ODM for MongoDB, written on top of Pydantic for data validation. Most importantly, it supports datetime.time
out-of-the-box because for some reason not even the official MongoDB library supports it. Do coders hate dates that much?
Install
pip install mongomapper
Quick start
Schemas
# examples/schemas.py
from mongomapper import Schema
class User(Schema):
__collection_name__ = 'users'
name: str
doc = User.create(name="John")
print(doc.data)
References
# examples/references.py
from mongomapper import Schema, Reference
class Person(Schema):
__collection_name__ = 'people'
name: str
class Phone(Schema):
__collection_name__ = 'phones'
owner: Reference(Person)
person = Person.create(name="John")
phone = Phone.create(owner=person)
print(person.data)
print(phone.data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mongomapper-1.0.0.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for mongomapper-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b31a9cdf7f865ab60308e6fabdc967d98c14a02d9232990fa39d4f21d53e19e |
|
MD5 | 1e0ec586c236270cb66abc4b2f60144d |
|
BLAKE2b-256 | cdd621e030bd3c7b2ef5778bc1a7f30789a71d6378539b1c3bdf3db8da885b8b |