MODELS for MONGODB
Project description
#MDB- MongoDB Models
[![Build Status](https://travis-ci.org/RevelutionWind/MDB.svg?branch=master)](https://travis-ci.org/RevelutionWind/MDB)
[![PyPI version](https://badge.fury.io/py/mondb.svg)](http://badge.fury.io/py/mondb)
[![PyPI](https://img.shields.io/pypi/dm/mondb.svg)](https://pypi.python.org/pypi/mondb)
[![Code Health](https://landscape.io/github/RevelutionWind/MDB/master/landscape.svg?style=flat)](https://landscape.io/github/RevelutionWind/MDB/master)
##Installation
Inorder to install
```
pip install mondb
```
##Models
Inorder to create a Model you first need to inherit Document class in Mongodb
```python
from mdb.Connection import create_engine
import mdb
create_engine(database ="Management", host= "localhost", port=27017)
class Management(mdb.Document):
name = mdb.StringProperty()
age = mdb.IntegerProperty()
m = Management(name = "sathya", age =23)
m.save()
#inorder to query the entity
cursor = Management.find({"name":"sathya"})
for element in cursor:
print element[0].name,element[0].age
```
##Query
```
query = mdb.Query(Management)
query.filter("name", "==", "sathya")
lst = query.fetch()
for l in lst:
print l
```
[![Build Status](https://travis-ci.org/RevelutionWind/MDB.svg?branch=master)](https://travis-ci.org/RevelutionWind/MDB)
[![PyPI version](https://badge.fury.io/py/mondb.svg)](http://badge.fury.io/py/mondb)
[![PyPI](https://img.shields.io/pypi/dm/mondb.svg)](https://pypi.python.org/pypi/mondb)
[![Code Health](https://landscape.io/github/RevelutionWind/MDB/master/landscape.svg?style=flat)](https://landscape.io/github/RevelutionWind/MDB/master)
##Installation
Inorder to install
```
pip install mondb
```
##Models
Inorder to create a Model you first need to inherit Document class in Mongodb
```python
from mdb.Connection import create_engine
import mdb
create_engine(database ="Management", host= "localhost", port=27017)
class Management(mdb.Document):
name = mdb.StringProperty()
age = mdb.IntegerProperty()
m = Management(name = "sathya", age =23)
m.save()
#inorder to query the entity
cursor = Management.find({"name":"sathya"})
for element in cursor:
print element[0].name,element[0].age
```
##Query
```
query = mdb.Query(Management)
query.filter("name", "==", "sathya")
lst = query.fetch()
for l in lst:
print l
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mondb-0.0.3.1.tar.gz
(9.8 kB
view hashes)