Comparing version 0.2.12 to 0.2.13
@@ -146,6 +146,11 @@ "use strict"; | ||
yield setupMany(collection, documents); | ||
const findOneAndUpdateUndefinedResult = yield collection.findOneAndUpdate({ undefinedKey: 'unknown' }, { $set: { name: 'foo2' } }); | ||
const findOneAndUpdateResult = yield collection.findOneAndUpdate(documents[0], { $set: { name: 'foo2' } }); | ||
const findOneAndReplaceResult = yield collection.findOneAndReplace(documents[1], Object.assign({}, documents[1], { name: 'bar1' }), { returnOriginal: false }); | ||
const findOneAndDeleteResult = yield collection.findOneAndDelete(documents[2]); | ||
t.equal(findOneAndUpdateUndefinedResult.has(), false, 'findOneAndUpdateUndefinedResult.has() should return false'); | ||
t.equal(findOneAndUpdateUndefinedResult.get(), null, 'findOneAndUpdateUndefinedResult.get() should return null'); | ||
t.equal(findOneAndUpdateResult.has(), true, 'findOneAndUpdateResult.has() should return true'); | ||
t.same(findOneAndUpdateResult.get().name, 'foo', 'findOneAndUpdateResult should contain an original document'); | ||
t.equal(findOneAndReplaceResult.has(), true, 'findOneAndReplaceResult.has() should return true'); | ||
t.same(findOneAndReplaceResult.get().name, 'bar1', 'findOneAndReplaceResult should contain a replaced document'); | ||
@@ -152,0 +157,0 @@ t.same(findOneAndDeleteResult.get().toObject(), documents[2].toObject(), 'findOneAndDeleteResult should contain a deleted document'); |
@@ -29,4 +29,7 @@ "use strict"; | ||
constructor({ lastErrorObject, factory, value }) { | ||
this.ref = null; | ||
this.lastError = lastErrorObject; | ||
this.ref = value ? factory(value) : null; | ||
if (!!value) { | ||
this.ref = factory(value); | ||
} | ||
} | ||
@@ -33,0 +36,0 @@ has() { |
{ | ||
"name": "mongot", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "A lightweight typed MongoDb library for TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
137795
2022