【文件属性】:
文件名称:backbone-db-mongodb:MongoDB 的主干数据库驱动程序
文件大小:11KB
文件格式:ZIP
更新时间:2021-06-06 21:45:58
JavaScript
用法
var MongoDB = require ( 'backbone-db-mongodb' ) ;
var Model = require ( 'backbone-promises' ) . Model ;
var store = new MongoDB ( mongoClient ) ;
var MyModel = Model . extend ( {
db : store ,
sync : store . sync ,
mongo_collection : 'mymodels'
} ) ;
var a = new MyModel ( { id : "1" , "data" : 123 } ) ;
a . save ( ) . then ( function ( ) {
var b = new Model ( { id : 1 } ) ;
return b .
【文件预览】:
backbone-db-mongodb-master
----.jshintrc(3KB)
----.gitignore(15B)
----package.json(670B)
----Makefile(794B)
----.travis.yml(343B)
----LICENSE(1KB)
----index.js(9KB)
----Readme.md(626B)
----test()
--------setup.js(2KB)
--------test.collection.js(2KB)
--------test.model.js(3KB)
--------test.backbone_db.js(436B)
--------test.queries.js(13KB)