When the setting "persistUndefinedAsNull" is true,
the model will use `null` instead of `undefined` in
all property values.
- Known optional model properties are set to `null` when no value
was provided.
- When setting model properties, `undefined` is always converted
to `null`. This applies to both known (model-defined) properties
and additional (custom, dynamic) properties.
- The instance method `toObject()` converts `undefined` to `null` too.
Because `toJSON()` calls `toObject()` under the hood, the change
applies to `toJSON()` too.
* Code cleanup in updateAll/deleteAll (Miroslav Bajtoš)
* Return scope object from DAO.scope (Fabien Franzen)
* Remove all usages of lodash. (Miroslav Bajtoš)
* Clean up delete and update tests (Simon Ho)
* Clean up wording in update/delete tests (Simon Ho)
* Fix wording in update test (Simon Ho)
* Properly support embedsMany destroyAll (Fabien Franzen)
* Clean up update/delete manipulation tests (Simon Ho)
* test: fix test failure in MySQL connector (Miroslav Bajtoš)
* Improve test failure messages (Miroslav Bajtoš)
* Fix regression in prototype.save (Miroslav Bajtoš)
* Enable more CRUD remoting methods for embedsOne (Fabien Franzen)
* Implement scope.findOne (Fabien Franzen)
* use findOrCreate for HasManyThrough#create (Clark Wang)
* Enhance id comparision for updateAttributes (Raymond Feng)
* Enable custom methods on singular relations (Fabien Franzen)
* Implement scope.findById (Fabien Franzen)
* Fix updateAll callback in "transient" connector (Miroslav Bajtoš)
* Memory connector returns updated records count (Simon Ho)
* Add ctx.isNewInstance for "save" hooks (Miroslav Bajtoš)
* deleteAll returns number of deleted records (Miroslav Bajtoš)
* Use the correct way to iterate over an array (Raymond Feng)
* DAO: Fix updateOrCreate to set persisted:true (Miroslav Bajtoš)
* Reject CREATE with a duplicate id (Miroslav Bajtoš)
* add tests for between in memory connector (Daniel B. Vasquez)
* enable between filter for memory db connector (Daniel B. Vasquez)
* fix#429 Multiple Models can't mixin same class (Clark Wang)
Rename the second callback argument to `info` to make its purpose more
clear. Fix jsdoc comments, note that these comments are NOT shown
on http://apidocs.strongloop.com/.
This commit is dropping lodash in favour of hand-written implementation
based on ES5 Array methods. As a result, the size of the (unminified)
loopback browser bundle is decreased by approx 360KB.
ffcaa4e7 added a "data" argument to the callback function, which
shadowed the original data with the data returned by a connector.
Not all connectors are returning a data object though, in which case
the model instance ("this" object) is updated with wrong values.
This commit fixes the problem by renaming the second callback argument
to "unusedData".
"before save" hooks provide "ctx.isNewInstance" whenever "ctx.instance"
is set. Possible values:
- true for all CREATE operations
- false for all UPDATE operations
- undefined for "prototype.save"
"after save" hooks provide "ctx.isNewInstance" whenever "ctx.instance"
is set. Possible values:
- true after all CREATE operations
- false after all UPDATE operations
- undefined after "updateOrCreate" and "save"
Note: both "updateOrCreate" and "prototype.updateAttributes"
don't provide `ctx.instance` to "before save" hooks, therefore
`ctx.isNewInstance` it not provided either.