Skip to main content

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mongomapper-1.2.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

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

Hashes for mongomapper-1.2.1.tar.gz
Algorithm Hash digest
SHA256 fa72cd760609affd267c6a019fce4a8f21043c82cf05eaa972489283e89c253c
MD5 f578b4faabcbd0221eb4f6fb9470c57c
BLAKE2b-256 0bd7860e0e723b14532b8606b1609bc60a274273cbb91d32ef4d95e08a20730c

See more details on using hashes here.

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

Hashes for mongomapper-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0114f31e2e98369e6841fa4b935658ede4e386b27d62f479acabcc1a34546543
MD5 dc932ac442745d784c0fde9d7394e7b8
BLAKE2b-256 3ea736efb5a86e05dcc60cf3bb605e471e699efcccab242b5cc42bd5e8b34e7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page