+ db
This commit is contained in:
1 parent
c7cd375757
commit
2028aacf08
1 file changed
+15
@@ -0,0 +1,15 @@
|
|||||||
|
import {MongoClient} from 'mongodb';
|
||||||
|
import co from 'co';
|
||||||
|
|
||||||
|
export var db;
|
||||||
|
|
||||||
|
export function connect(uri){
|
||||||
|
return co(function*() {
|
||||||
|
db = yield MongoClient.connect(uri);
|
||||||
|
return db;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function collection(name){
|
||||||
|
return db.collection(name);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user