The PR superseeds the existing deepMerge algorithm used to merge
settings of parent and child models with a new algorithm that allows
to specify the way each setting is merged or mixed-in.
This configuration of this algorithm uses a merge policy specification.
The `getMergePolicy()` helper of BaseModelClass can be used to ease
model merge configuration.
Next is presented the expected merge behaviour for each option.
NOTE: This applies to top-level settings properties
- Any
- `{replace: true}` (default): child replaces the value from parent
- assignin `null` on child setting deletes the inherited setting
- Arrays
- `{replace: false}`: unique elements of parent and child cumulate
- `{rank: true}` adds the model inheritance rank to array
elements of type Object {} as internal property `__rank`
- Object {}:
- `{replace: false}`: deep merges parent and child objects
- `{patch: true}`: child replaces inner properties from parent
The recommended merge policy is returned by getMergePolicy()
when calling the method with option `{configureModelMerge: true}`.
The legacy built-in merge policy is returned by `getMergePolicy()`
when avoiding option `configureModelMerge`.
NOTE: it also delivers ACLs ranking in addition to the legacy
behaviour as well as fixes for settings `description` and `relations`
`getMergePolicy()` can be customized using model's setting
`configureModelMerge` as follows:
```
{
// ..
options: {
configureModelMerge: {
// merge options
}
}
// ..
}
```
`getMergePolicy()` method can also be extended programmatically as
follows:
```
myModel.getMergePolicy = function(options) {
const origin = myModel.base.getMergePolicy(options);
return Object.assign({}, origin, {
// new/overriding options
});
};
```
* create sequence for nosql id (#1354) (Janny)
* Fix order of query results (Loay)
* Add DateString type (Kevin Delisle)
* datatype.test: use predefined date (Kevin Delisle)
* Update api documents (Loay)
* Datasource documentation tune-up (Kevin Delisle)
* Added unit tests specific to DateType where null (#1349) (Andrew McDonnell)
* Fix/geo null (#1334) (paulussup)
* replace exception thrown for invalid dates (Diana Lau)
* Revert PR #1326 (#1336) (Sakib Hasan)
* Make lib peerDepend on loopback-connector (#1326) (Russ Tyndall)
* Add test case using updateAttributes (Loay)
* Fix forceId bug for updateOrCreate (Loay)
* Fix typo in description (jannyHou)
* Fix relations test case (loay)
New type that preserves string input as a string, but ensures that
the string is a valid Date.
Additionally, provides a .toDate function to provide the Date
object representation of the string.
Some databases are storing the value in UTC (not ISO) format,
and truncating the values. Even though this is technically
unavoidable, it does fail strict string equality.
* fix check for null
* add tests
* fix for early return
* Allow check for null and non-existent value
Some connectors uses a non existent prop instead of allowing null
Modified test case to look if null exists or the prop is non existent
* Check for null value with geo near query
* Apply requested changes
* change test to two users and simplify
* check error first
* Fix simple query test case with null value
* BDD for connectors w//o null support
* Add instructions for running the tests (#1330) (Andrew McDonnell)
* handle deep geo-near queries (#1314) (Eric Barault)
* Unskip test case (Loay)
* Make tests work for other connectors as well as C* (Tetsuo Seto)
* Remove debugger statement (Tetsuo Seto)
* Fixup test support for Cassandra connector (Tetsuo Seto)
* Add test support for Cassandra connector (Tetsuo Seto)
* package: use loopback-connector@^4.0.0 (Kevin Delisle)
* Revert "handle deep geo-near queries (#1216)" (Sakib Hasan)
* Revert "Allow `after save` hook to see count of records changed (#1231)" (Sakib Hasan)
* Allow `after save` hook to see count of records changed (#1231) (Joshua Chaitin-Pollak)
* handle deep geo-near queries (#1216) (Corentin H)
* Fix model def column name method (#1224) (destillat)
* Added notify flag for create and upsert (#1277) (Jonathan Sheely)
* Custom Table Names on rels (#1303) (Waldemar Zahn)
* Support multiple fk relations (#1308) (Sakib Hasan)
* #1261 Property name "constructor" is not allowed in 'Model' data (#1284) (Thaer Abbas)
* handle deep geo-near queries (#1216)
a dedicated mongKey is added in geo.nearFilter for mongoDB
fixes geo min distance tests as filter now expects an array
* Fix for string geoPoints
* Add geo point handle for ibmdb connectors
* Handle geo-point type for cassandra connector