A fast unobtrusive MongoDB ODM for Python.
Python
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.pytest_cache/v/cache Fix for empty dictionaries not being converted to sub frames Aug 13, 2018
mongoframes Added support for projections with mongo keywords in Aug 15, 2018
performance Renamed performance stuff so no conflict with real tests Jun 29, 2016
snippets Fixes for publishing snippet. Jul 1, 2016
tests Fix for empty dictionaries not being converted to sub frames Aug 13, 2018
.gitignore Minor set up changes. Jun 27, 2016
.travis.yml Added tests for blueprints. Aug 3, 2016
LICENSE Added base setup structure for the project Feb 13, 2016
MANIFEST.in Added support for tox. Jun 27, 2016
README.md
lib64
pip-selfcheck.json
setup.cfg
setup.py
tox.ini Update sdist for travis-ci. Aug 2, 2016

README.md

MongoFrames logo

MongoFrames

Build Status Join the chat at https://gitter.im/GetmeUK/ContentTools

MongoFrames is a fast unobtrusive MongoDB ODM for Python designed to fit into a workflow not dictate one. Documentation is available at MongoFrames.com and includes:

Installation

We recommend you use virtualenv or virtualenvwrapper to create a virtual environment for your install. There are several options for installing MongoFrames:

  • pip install MongoFrames (recommended)
  • easy_install MongoFrames
  • Download the source and run python setup.py install

Dependencies

10 second example

from mongoframes import *

# Define some document frames (a.k.a models)
class Dragon(Frame):
    _fields = {'name', 'loot'}

class Item(Frame):
    _fields = {'desc', 'value'}

# Create a dragon and loot to boot
Item(desc='Sock', value=1).insert()
Item(desc='Diamond', value=100).insert()
Dragon(name='Burt', loot=Item.many()).insert()

# Have Burt boast about his loot
burt = Dragon.one(Q.name == 'Burt', projection={'loot': {'$ref': Item}})
for item in burt.loot:
    print('I have a {0.name} worth {0.value} crown'.format(item))

Testing

To test the library you'll need to be running a local instance of MongoDB on the standard port.

To run the test suite: py.test To run the test suite on each supported version of Python: tox

Helpful organizations

MongoFrames is developed using a number of tools & services provided for free by nice folks at organizations committed to supporting open-source projects including GitHub and Travis CI.