loopback-datasource-juggler/lib
Miroslav Bajtoš fd03302f08
Do not apply default values on data from database
Before this change, when a property was configured with a default value
at LoopBack side and the database was returned a record with a missing
value for such property, then we would supply use the configured
default.

This behavior is problematic for reasons explained in #1692.

In this commit, we are introducing a new model-level setting called
`applyDefaultsOnReads`, which is enabled by default for backwards
compatibility.

When this setting is set to `false`, operations like `find` and
`findOrCreate` will NOT apply default property values on data returned
by the database (connector).

Please note that most of the other CRUD methods did not apply default
values on database data as long as the connector provided native
implementation of the operation, that aspect is not changing.

Also note that default values are applied only on properties with
`undefined` values. The value `null` does not trigger application of
default values. This is important because SQL connectors return
`null` for properties with no value set.
2019-04-09 13:03:37 +02:00
..
connectors eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
kvao eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
browser.depd.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
dao.js Do not apply default values on data from database 2019-04-09 13:03:37 +02:00
datasource.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
date-string.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
geo.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
hooks.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
include.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
include_utils.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
introspection.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
jutil.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
list.js feat: support array within array in 3.x 2019-03-14 16:46:03 +05:30
mixins.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
model-builder.js feat: Support "type" key in sub-properties in 3.x 2019-03-07 16:50:29 +05:30
model-definition.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
model-utils.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
model.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
observer.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
relation-definition.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
relations.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
scope.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
transaction.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
types.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
utils.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
validations.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00