loopback-connector-mongodb
Advanced tools
Comparing version
@@ -0,1 +1,13 @@ | ||
2020-02-10, Version 5.2.2 | ||
========================= | ||
* chore: update copyright year (Diana Lau) | ||
* chore: update CODEOWNERS (Diana Lau) | ||
* coerce property value defined as array of ObjectID (=) | ||
* fix: update the error message and name (#561) (Janny) | ||
2019-11-22, Version 5.2.1 | ||
@@ -2,0 +14,0 @@ ========================= |
// Copyright IBM Corp. 2019. All Rights Reserved. | ||
// Node module: loopback-connector-postgresql | ||
// This file is licensed under the Artistic License 2.0. | ||
// License text available at https://opensource.org/licenses/Artistic-2.0 | ||
// Node module: loopback-connector-mongodb | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
@@ -6,0 +6,0 @@ 'use strict'; |
// Copyright IBM Corp. 2019. All Rights Reserved. | ||
// Node module: loopback-connector-postgresql | ||
// This file is licensed under the Artistic License 2.0. | ||
// License text available at https://opensource.org/licenses/Artistic-2.0 | ||
// Node module: loopback-connector-mongodb | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
@@ -6,0 +6,0 @@ 'use strict'; |
@@ -1,2 +0,2 @@ | ||
// Copyright IBM Corp. 2012,2019. All Rights Reserved. | ||
// Copyright IBM Corp. 2012,2020. All Rights Reserved. | ||
// Node module: loopback-connector-mongodb | ||
@@ -2133,3 +2133,12 @@ // This file is licensed under the MIT License. | ||
} else if (typeIsObjectId(dataType)) { | ||
if (isObjectIDProperty(modelCtor, propDef, propValue)) { | ||
if (Array.isArray(propValue)) { | ||
propValue = propValue.map(val => { | ||
if (isObjectIDProperty(modelCtor, propDef, val)) { | ||
return coercedValue = ObjectID(propValue); | ||
} else { | ||
throw new Error(`${val} is not an ObjectID string`); | ||
} | ||
}); | ||
return setValue(coercedValue); | ||
} else if (isObjectIDProperty(modelCtor, propDef, propValue)) { | ||
coercedValue = ObjectID(propValue); | ||
@@ -2144,3 +2153,7 @@ return setValue(coercedValue); | ||
// Object ID coercibility depends on multiple factors, let coerceToObjectId() handle it | ||
propValue = coerceToObjectId(modelCtor, propDef, propValue); | ||
if (Array.isArray(propValue)) { | ||
propValue = propValue.map(val => coerceToObjectId(modelCtor, propDef, val)); | ||
} else { | ||
propValue = coerceToObjectId(modelCtor, propDef, propValue); | ||
} | ||
setValue(propValue); | ||
@@ -2147,0 +2160,0 @@ } |
{ | ||
"name": "loopback-connector-mongodb", | ||
"version": "5.2.1", | ||
"version": "5.2.2", | ||
"description": "The official MongoDB connector for the LoopBack framework.", | ||
@@ -5,0 +5,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
9
-47.06%131658
-54.04%49
-14.04%2492
-64.01%