Comparing version 0.0.12 to 0.0.13
{ | ||
"name": "typeodm", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "ODM for MongoDB used Typescript", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -49,4 +49,7 @@ 'use strict'; | ||
return documentPromise.then(function (document) { | ||
if (!document && documentId) throw new Error('Document ' + schema.name + ' with given id ' + documentId + ' was not found'); | ||
if (!document && documentConditions) throw new Error('Document ' + schema.name + ' with given conditions ' + JSON.stringify(documentConditions) + ' was not found'); | ||
if (!document) document = schema.create(); | ||
//if (!document && documentId) | ||
//throw new Error('Document ' + schema.name + ' with given id ' + documentId + ' was not found'); | ||
//if (!document && documentConditions) | ||
//throw new Error('Document ' + schema.name + ' with given conditions ' + JSON.stringify(documentConditions) + ' was not found'); | ||
return Promise.all(Object.keys(object).filter(function (key) { | ||
@@ -53,0 +56,0 @@ return schema.hasFieldOrRelationWithPropertyName(key); |
@@ -13,4 +13,2 @@ "use strict"; | ||
var _exceptionNoDocumentWithSuchIdException = require("../exception/NoDocumentWithSuchIdException"); | ||
/** | ||
@@ -51,3 +49,4 @@ * Helps to remove a document and all its relations by given cascade operations. | ||
return this.connection.driver.findOneById(schema.name, documentId).then(function (dbObject) { | ||
if (!dbObject) throw new _exceptionNoDocumentWithSuchIdException.NoDocumentWithSuchIdException(documentId, schema.name); | ||
if (!dbObject) return Promise.resolve(); | ||
//throw new NoDocumentWithSuchIdException(documentId, schema.name); | ||
// iterate throw each key in the document and find relations to compute removals of | ||
@@ -119,3 +118,4 @@ var promises = Object.keys(dbObject).map(function (originalDocumentProperty) { | ||
return this.connection.driver.findOneById(schema.name, documentId).then(function (dbObject) { | ||
if (!dbObject) throw new _exceptionNoDocumentWithSuchIdException.NoDocumentWithSuchIdException(documentId, schema.name); | ||
if (!dbObject) return Promise.resolve(); | ||
// throw new NoDocumentWithSuchIdException(documentId, schema.name); | ||
// iterate throw each key in the db document and find relations to compute removals of | ||
@@ -122,0 +122,0 @@ var promises = Object.keys(dbObject).map(function (originalDocumentProperty) { |
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
321755
6489