Skip to main content

nanomongo

nanomongo is a minimal MongoDB Object-Document Mapper for Python. It does not attempt to be a feature-complete ODM but if you like using pymongo api with python dictionaries and often find yourself writing validators and pymongo.Collection wrappers, nanomongo might suit your needs.

nanomongo has full test coverage.

Quick Links: Source (github) - Documentation (rtd) - Packages (PyPi)

Version 0.4: Utility methods dbref_field_getters, BaseDocument.get_dbref and Bugfix Python23 text type compatibility

Version 0.3: nanomongo is now python2 compatible (with syntactic difference when defining your Document, refer to Documentation)

https://travis-ci.org/eguven/nanomongo.png

Features

  • single format Field definitions with type checking and a few common options such as required, default, auto_update

  • pymongo-identical index definitions

  • optional dot_notation

  • assignment and deletion (delta) tracking for '$set' and '$unset' and atomic updates; you either insert or update

  • '$addToSet' on Document

  • upcoming '$push' '$pull' funtionality

# rough example
import pymongo
from nanomongo import Field, BaseDocument, Index

client = pymongo.MongoClient()

class MyDoc(BaseDocument, dot_notation=True, client=client, db='dbname'):
    foo = Field(str)
    bar = Field(int, required=False)

    __indexes__ = [
        Index('foo'),
        Index([('bar', 1), ('foo', -1)], unique=True),
    ]

doc = MyDoc(foo='L33t')
doc.bar = 42
doc.insert()

Doc.find_one({'foo': 'L33t'})

nanomongo is Python23 compatible and I intend to support both pymongo & motor transparently under the hood.

Contributions and insight are welcome!

Author:

Eren Güven (GitHub, Twitter)

License:

Apache Software License

Metadata

Release files for nanomongo 0.4.1

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

Source distribution (sdist)

Source distribution for nanomongo 0.4.1
File Size Uploaded Provenance
nanomongo-0.4.1.tar.gz 20.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 36.0 kB

Release files / nanomongo-0.4.1.tar.gz

Download URL nanomongo-0.4.1.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
16eea6890f288c2b2cf4810fc6586e91f0fd642132caf7ccb49ac8fbeabae4c2
BLAKE2b-256 checksum
How to use checksums
4ea252117e0f19515327d81cb3b3656726c0d66e6bbf10b6246b18f57d5e1886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nanomongo-0.4.1-py2.py3-none-any.whl

Download URL nanomongo-0.4.1-py2.py3-none-any.whl
Size 16.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e733ae1a3a521ab3daca0e27ac0a437541a830fbe2375b464f66d1b098b78576
BLAKE2b-256 checksum
How to use checksums
35a22a06d69037fd28a0d463ea7ea6ef6e410ac6e28e2f66b83d565ba4e0babb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nanomongo 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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