MODELS for MONGODB
Project description
#MDB- MongoDB Models
[](https://travis-ci.org/RevelutionWind/MDB)
[](http://badge.fury.io/py/mondb)
[](https://pypi.python.org/pypi/mondb)
[](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
```
[](https://travis-ci.org/RevelutionWind/MDB)
[](http://badge.fury.io/py/mondb)
[](https://pypi.python.org/pypi/mondb)
[](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 details)
File details
Details for the file mondb-0.0.3.1.tar.gz.
File metadata
- Download URL: mondb-0.0.3.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
751d863ba78dc145fd96397cc56634f824820791682f29ef007444bcf2b14603
|
|
| MD5 |
6ca4a3f6b1ae4198b8e2a937507c338d
|
|
| BLAKE2b-256 |
12b71a31905227f65c90394a6fed53209f9031d2642742f2010508b51ed0cb0d
|