reactive-mongodb
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -14,6 +14,10 @@ const Observable = require('rxjs/Rx').Observable; | ||
class Collection { | ||
constructor(name) { | ||
this.collection = global.db.collection(name); | ||
this.name = name; | ||
} | ||
insert(object) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -29,4 +33,8 @@ (observer) => { | ||
}); | ||
} | ||
updateOne(object, newObject) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -43,2 +51,5 @@ (observer) => { | ||
update(object, newObject) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -59,2 +70,5 @@ (observer) => { | ||
updateById(id, newObject) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.namename); | ||
} | ||
return Observable.create( | ||
@@ -77,2 +91,5 @@ (observer) => { | ||
delete(query) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -89,2 +106,5 @@ (observer) => { | ||
deleteById(id) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -107,2 +127,5 @@ (observer) => { | ||
find(query) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -122,2 +145,5 @@ (observer) => { | ||
findOne(query) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -140,2 +166,5 @@ (observer) => { | ||
findById(id) { | ||
if (!this.collection) { | ||
this.collection = global.db.collection(this.name); | ||
} | ||
return Observable.create( | ||
@@ -163,2 +192,2 @@ (observer) => { | ||
module.exports = Collection; | ||
module.exports = Collection; |
{ | ||
"name": "reactive-mongodb", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "An ODM for MongoDB with very strict data types/stucture. It is Based on Observable (with RxJS)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17802
267