Skip to main content


Project description

#MDB- MongoDB Models

[![Build Status](](
[![PyPI version](](
[![Code Health](](


You can install mondb from its official pypi repository.

pip install mondb


Inorder to create a Model you first need to inherit Document class in Mondb

from mondb.Connection import create_engine
import mondb

#used to establish a connection with the collection
create_engine(database ="Management", host= "localhost", port=27017)

class User(mdb.Document):
name = mondb.StringProperty()
age = mondb.IntegerProperty()

m = User(name = "sathya", age =23)

##Searching and Updating

In most of the case where the user needs to search and update models.
Mondb comes with methods such as <b>search()</b> and <b>find()</b> for finding
a document from the collection.


#search returns a matching records as pymongo cursor.
cursor ="sathya")

# Note:
# cursor is not a list but can be indexed. use list(cursor) if you want to use
# it as a list

for record in cursor:
print record



Mondb also comes with a Query object where you can Query with some


query = mondb.Query(User)

query.filter("age", ">=", 20)

lst = query.fetch()

for l in lst:
print l


Methods such as <b>filter()</b> and <b> fetch()</b> will be handy for getting results from
the query.


Mondb models can be deleted with the help of <b> delete() </b> method.


user =[0]




Project details

Download files

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

Files for mondb, version
Filename, size File type Python version Upload date Hashes
Filename, size mondb- (10.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page