pymongo-bongoSytax sugar for PyMongo and MongoDB | |
Download |
pymongo-bongo Ranking & Summary
Advertisement
- License:
- BSD License
- Price:
- FREE
- Publisher Name:
- Alexander Artemenko
- Publisher web site:
- http://github.com/svetlyak40wt/
pymongo-bongo Tags
pymongo-bongo Description
Sytax sugar for PyMongo and MongoDB pymongo-bongo is a Python library that contains wrappers to add some syntax sugar to PyMongo for easier interaction with the Mongo database using "python way".Installation:If you have setuptools installed you should be able to do easy_install pymongo-bongo to install PyMongoBongo. Otherwise you can download the project source and do python setup.py install to install.Examples:Here's a basic example:>>> from pymongo.connection import Connection>>> from mongobongo import Document>>> class Article(Document):... collection = 'articles'... def get_full_title(self):... return '%s (%s)' % (self.title, ', '.join(self.tags))>>> connection = Connection("localhost", 27017)>>> Article.objects.db = connection.test>>> article = Article(author = 'Alex', title = 'Pink Pony's Life', tags = )>>> article.save()>>> articles = Article.objects.all()>>> len(articles)1>>> article = Article(author = 'Alex', title = 'Long Long Python', tags = , subtitle = 'Not such long')>>> article.save()>>> articles = Article.objects.all()>>> len(articles)2>>> python_articles = Article.objects.find({'tags': 'python'})>>> len(python_articles)1>>> python_articles.title'Long Long Python' Requirements: · Python · pymongo · Epydoc · nose What's New in This Release: · Fixed __len__ method, broken by changes in pymongo 1.1.1. Now mongobongo depends on pymongo >= 1.1.1.
pymongo-bongo Related Software