Skip to content
A lightweight, Pythonic, Object Oriented Interface to MongoDB.
Python
Find file
Latest commit 29f3899 Sep 27, 2015 @superbobry superbobry Fixed tests and ported to Python3, closes #30
  the last supported version of ``pymongo`` is 2.8
Failed to load latest commit information.
docs
minimongo Fixed tests and ported to Python3, closes #30 Sep 27, 2015
.gitignore
AUTHORS.rst Added a BSD license, closes #38 Sep 26, 2015
CHANGES.txt Initial commit copy from working code Dec 20, 2010
LICENSE
MANIFEST.in Added MANIFEST.in, closes #36 Jul 21, 2015
README.rst
runtests.py Migrated to py.test Mar 14, 2011
setup.py Fixed tests and ported to Python3, closes #30 Sep 27, 2015

README.rst

minimongo

Info:Minimal database Model management for MongoDB.
Author:Steve Lacy (github@slacy.com)

About

minimongo is a lightweight, schemaless, Pythonic Object-Oriented interface to MongoDB.

It provides a very thin, dynamicly typed (schema-less) object management layer for any data stored in any MongoDB collection. minimongo directly calls the existing pymongo query syntax.

minimongo can easily layer on top of existing MongoDB collections, and will work properly with almost any existing schema, even from third party applications.

Installation

If you have setuptools you can use easy_install -U minimongo. Otherwise, you can download the source from GitHub and run python setup.py install.

Dependencies

Example

Here's a very brief example of creating an object, querying for it, modifying a field, and then saving it back again:

from minimongo import Model, Index

class Foo(Model):
    class Meta:
        # Here, we specify the database and collection names.
        # A connection to your DB is automatically created.
        database = "minimongo"
        collection = "rocks"

        # Now, we programatically declare what indices we want.
        # The arguments to the Index constructor are identical to
        # the args to pymongo"s ensure_index function.
        indices = (
            Index("a"),
        )


if __name__ == "__main__":
    # Create & save an object, and return a local in-memory copy of it:
    foo = Foo({"x": 1, "y": 2}).save()

    # Find that object again, loading it into memory:
    foo = Foo.collection.find_one({"x": 1})

    # Change a field value, and save it back to the DB.
    foo.other = "some data"
    foo.save()

Feedback welcome!

Please email github@slacy.com with comments, suggestions, or comment via http://github.com/slacy/minimongo

Something went wrong with that request. Please try again.