Comparing version 2.1.17 to 2.1.18
@@ -0,1 +1,6 @@ | ||
### v2.1.18 - 29 Jul 2014 | ||
- Add `alwaysValidate` flag (#540, #352) | ||
- Fix mongo hasMany wrong instance bug (#479) | ||
- Fix mysql index bug (dresende/node-sql-ddl-sync#19) | ||
### v2.1.17 - 24 Jul 2014 | ||
@@ -2,0 +7,0 @@ - Fix postgres & sqlite driver conversion of floats and ints. |
@@ -24,3 +24,3 @@ # AnonTXT demo app | ||
npm install | ||
node tasks/reset | ||
node tasks/reset # sets up the database | ||
./script/start | ||
@@ -27,0 +27,0 @@ ``` |
@@ -260,7 +260,8 @@ var Utilities = require("../../Utilities"); | ||
var extra = {} | ||
conditions._id = { $in: [] }; | ||
options.extra = {}; | ||
for (var i = 0; i < docs[0][association.name].length; i++) { | ||
conditions._id.$in.push(new mongodb.ObjectID(docs[0][association.name][i]._id)); | ||
options.extra[docs[0][association.name][i]._id] = docs[0][association.name][i]; | ||
extra[docs[0][association.name][i]._id] = docs[0][association.name][i]; | ||
} | ||
@@ -270,12 +271,13 @@ | ||
options.order[0] = options.order[0][1]; | ||
options.order = Utilities.transformOrderPropertyNames( | ||
Utilities.standardizeOrder(options.order), | ||
Model.allProperties | ||
); | ||
} | ||
options.extra_props = association.props; | ||
options.createInstance = createInstance; | ||
return driver.find(null, association.model.table, conditions, options, cb); | ||
return association.model.find(conditions, options, function (e,docs) { | ||
var i, len; | ||
for (i = 0, len = docs.length; i < len; i++) { | ||
if (extra.hasOwnProperty(docs[i][association.model.id])) { | ||
docs[i].extra = extra[docs[i][association.model.id]]; | ||
} | ||
} | ||
cb(e, docs); | ||
}); | ||
}); | ||
@@ -282,0 +284,0 @@ }, |
@@ -57,2 +57,3 @@ var Utilities = require("./Utilities"); | ||
required = Model.allProperties[k].required; | ||
alwaysValidate = Model.allProperties[k].alwaysValidate; | ||
} else { | ||
@@ -66,4 +67,3 @@ for (i = 0; i < opts.one_associations.length; i++) { | ||
} | ||
if (!required && instance[k] == null) { | ||
if (!alwaysValidate && !required && instance[k] == null) { | ||
continue; // avoid validating if property is not required and is "empty" | ||
@@ -70,0 +70,0 @@ } |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version" : "2.1.17", | ||
"version" : "2.1.18", | ||
"license" : "MIT", | ||
@@ -42,3 +42,3 @@ "homepage" : "http://dresende.github.io/node-orm2", | ||
"sql-query" : "git+https://github.com/dresende/node-sql-query.git#v0.1.21", | ||
"sql-ddl-sync" : "git+https://github.com/dresende/node-sql-ddl-sync.git#v0.3.8", | ||
"sql-ddl-sync" : "git+https://github.com/dresende/node-sql-ddl-sync.git#v0.3.10", | ||
"hat" : "0.0.3", | ||
@@ -45,0 +45,0 @@ "lodash" : "2.4.1" |
@@ -739,2 +739,8 @@ ## Object Relational Mapping | ||
If a field is not required, but should be validated even if it is not present, then specify the `alwaysValidate` option. | ||
(this can happen, for example when validation of a null field depends on other fields in the record) | ||
```js | ||
Animal.hasOne("owner", Person, { required: false, alwaysValidate: true }); | ||
``` | ||
If you prefer to use another name for the field (owner_id) you can change this parameter in the settings. | ||
@@ -741,0 +747,0 @@ |
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
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
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
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
231695
5932
860