jsft-mongodb
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -168,2 +168,3 @@ 'use strict'; | ||
var collection = _Link2.default.getCollection(collectionName); | ||
var conditions = { _id: (0, _mongodb.ObjectId)(props.id) }; | ||
@@ -174,4 +175,4 @@ var updates = { | ||
return _Link2.default.getCollection(collectionName).update(conditions, updates).then(function () { | ||
return _Link2.default.getCollection(collectionName).findOne(conditions); | ||
return collection.update(conditions, updates).then(function () { | ||
return collection.findOne(conditions); | ||
}).then(function (doc) { | ||
@@ -193,6 +194,8 @@ return doc ? fromDocument(doc) : undefined; | ||
var collection = _Link2.default.getCollection(collectionName); | ||
var conditions = { _id: (0, _mongodb.ObjectId)(props.id) }; | ||
var collection = _Link2.default.getCollection(collectionName); | ||
return collection.update(conditions, toDocument(props)).then(collection.findOne(conditions)).then(function (doc) { | ||
return collection.update(conditions, toDocument(props)).then(function () { | ||
return collection.findOne(conditions); | ||
}).then(function (doc) { | ||
return doc ? fromDocument(doc) : undefined; | ||
@@ -199,0 +202,0 @@ }); |
@@ -35,3 +35,8 @@ 'use strict'; | ||
db = db || (0, _monk2.default)(dbUrl); | ||
db = db || (0, _monk2.default)(dbUrl, {}, function (err) { | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
collections[name] = collections.name || db.get(name); | ||
@@ -38,0 +43,0 @@ |
{ | ||
"name": "jsft-mongodb", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Functional abstraction layer for mongodb-storage of objects with structures defined with json-schema", | ||
@@ -32,3 +32,3 @@ "main": "lib/index.js", | ||
"mongodb": "^2.2.22", | ||
"monk": "^3.1.4" | ||
"monk": "^4.0.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
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
29275
683
+ Addedgitbook-plugin-github@2.0.0(transitive)
+ Addedmonk@4.1.0(transitive)
- Removedmonk@3.1.4(transitive)
Updatedmonk@^4.0.0