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.2.1.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mongomapper-1.2.1.tar.gz.
File metadata
- Download URL: mongomapper-1.2.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa72cd760609affd267c6a019fce4a8f21043c82cf05eaa972489283e89c253c
|
|
| MD5 |
f578b4faabcbd0221eb4f6fb9470c57c
|
|
| BLAKE2b-256 |
0bd7860e0e723b14532b8606b1609bc60a274273cbb91d32ef4d95e08a20730c
|
File details
Details for the file mongomapper-1.2.1-py3-none-any.whl.
File metadata
- Download URL: mongomapper-1.2.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0114f31e2e98369e6841fa4b935658ede4e386b27d62f479acabcc1a34546543
|
|
| MD5 |
dc932ac442745d784c0fde9d7394e7b8
|
|
| BLAKE2b-256 |
3ea736efb5a86e05dcc60cf3bb605e471e699efcccab242b5cc42bd5e8b34e7c
|