+
Skip to content

cool-shark/coolmongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Simple MongoDB ORM with Live Database Switch Feature

Usage

from coolmongo.fields import *
from coolmongo.orm import CoolMongoModel
from coolmongo.connection import CoolMongo

mongo_connection = CoolMongo('127.0.0.1', 27017, 5)

class TestModel(CoolMongoModel):
def __init__(self, data=None):
    self.build({
       'field1' : StringField(min_length=1, max_length=200),
       'field2' : BooleanField(default=False),
    }, mongo_connection, 'database_name')
    self._import(data)

test_instance = TestModel({
'field1': 'Test',
'field2': False
})
test_instance.save()

print test_instance._export(without_id=True)

test_instance.set('field2', True)
test_instance.save()

print test_instance._export(without_id=True)

About

Simple MongoDB ORM with Live Database Switch Feature

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载