{ "info": { "author": "plasmashadow", "author_email": "plasmashadowx@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2" ], "description": "#MDB- MongoDB Models\n\n[](https://travis-ci.org/RevelutionWind/MDB)\n[](http://badge.fury.io/py/mondb)\n[](https://pypi.python.org/pypi/mondb)\n[](https://landscape.io/github/RevelutionWind/MDB/master)\n\n##Installation\n \n You can install mondb from its official pypi repository.\n \n ```\n pip install mondb\n\n ```\n\n##Models\n Inorder to create a Model you first need to inherit Document class in Mondb\n \n ```python\n from mondb.Connection import create_engine\n import mondb\n \n \n #used to establish a connection with the collection\n create_engine(database =\"Management\", host= \"localhost\", port=27017)\n \n \n class User(mdb.Document):\n name = mondb.StringProperty()\n age = mondb.IntegerProperty()\n \n m = User(name = \"sathya\", age =23)\n m.save()\n ```\n \n##Searching and Updating\n\n In most of the case where the user needs to search and update models.\n Mondb comes with methods such as search() and find() for finding\n a document from the collection.\n \n \n ```python\n \n #search returns a matching records as pymongo cursor.\n cursor = User.search(name=\"sathya\")\n \n # Note:\n # cursor is not a list but can be indexed. use list(cursor) if you want to use\n # it as a list\n \n for record in cursor:\n print record\n \n ```\n \n##Query\n \n Mondb also comes with a Query object where you can Query with some \n criteria.\n \n ```python\n \n query = mondb.Query(User)\n \n query.filter(\"age\", \">=\", 20)\n \n lst = query.fetch()\n \n for l in lst:\n print l\n \n ```\n \n Methods such as filter() and fetch() will be handy for getting results from\n the query.\n \n \n##Deleting\n\n Mondb models can be deleted with the help of delete() method.\n \n ```python\n \n user = User.search(age=23)[0]\n user.delete()\n \n ```\n \n \n##License\n\n