loopback-datasource-juggler/test
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
..
fixtures/loopback-connector-throwing Fix datasource to report connector-loading errors 2017-02-03 20:29:11 +01:00
helpers eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
kvao eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
operation-hooks.suite eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
CustomTypeForeignKey.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
allow-extended-operators.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
async-observer.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
basic-querying.test.js Do not apply default values on data from database 2019-04-09 13:03:37 +02:00
common.batch.js Fix manually 2016-08-22 19:20:12 -04:00
common_test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
crud-with-options.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
datasource.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
datatype.test.js feat: Support "type" key in sub-properties in 3.x 2019-03-07 16:50:29 +05:30
date-string.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
default-scope.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
defaults.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
discovery.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
exclude-base-props.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
geo.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
hooks.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
include.test.js fix: use existing field in exclude test 2019-01-17 15:06:45 -05:00
include_util.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
init.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
introspection.test.js feat: support array within array in 3.x 2019-03-14 16:46:03 +05:30
json.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
kv-memory.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
kvao.suite.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
list.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
loopback-data.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
loopback-dl.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
manipulation.test.js Do not apply default values on data from database 2019-04-09 13:03:37 +02:00
memory.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
mixins.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
mocha.opts Configure Mocha to use dot reporter 2018-07-10 12:11:46 +02:00
mock-connectors.js Fix manually 2016-08-22 19:20:12 -04:00
model-builder.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
model-definition.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
model-inheritance.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
normalize-undefined.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
optional-validation.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
performance.coffee Reformat the code 2014-01-24 09:09:53 -08:00
persistence-hooks.suite.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
relations.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
schema.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
scope.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00
spec_helper.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
test1-schemas.json Reformat the code 2014-01-24 09:09:53 -08:00
test2-schemas.json Reformat the code 2014-01-24 09:09:53 -08:00
transaction.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
transient.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
util.test.js eslint: autofix linting errors 2018-12-07 17:13:48 +01:00
validations.test.js eslint: manually fix remaining problems 2018-12-07 17:14:57 +01:00