Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Minimal Python ODM for MongoDB

Project Description

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)

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
Release History

Release History

This version
History Node

0.4.1

History Node

0.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nanomongo-0.4.1-py2.py3-none-any.whl (16.0 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Mar 1, 2015
nanomongo-0.4.1.tar.gz (20.0 kB) Copy SHA256 Checksum SHA256 Source Mar 1, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting