Rework setup of the Operation Hooks test suite for memory connector
so that the "unoptimized" variant disables not only atomic CRUD
operations, but also geo queries.
This way we can test both "near" querying implementations:
- When the connectors supports "near" queries natively.
- When "near" queries are executed at LoopBack side in-memory.
Enhance the built-in memory connector to correctly support nested
queries for arrays in addition to objects.
E.g. if "friends" is an array of objects containing "name", then
{ where: { "friends.name": "Jane" } } should match records containing
a friend called "Jane".
Adds support for the ability to query embedsMany models from the parent.
Fix a memory connector bug that could occur when having an "or" or "and"
clause combined with another property. In that case, the and would revert
true for 'Paul McCartney'
```
{name:'John Lennon',and: [{role:'lead'}, {vip:true}]}}
```
Changes the after `save` callback in the memory connector to use the
`fromDb` method to deserialize the data passed back to upsert and
updateAttributes methods.
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
remove undefined for creating data in findOrCreate
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
getLastGeneratedUid instead of force an id
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
This patch introduces a new API for "intent-based" hooks. These hooks
are not tied to a particular method (e.g. "find" or "update"). Instead,
they are triggered from all methods that execute a particular "intent".
The consumer API is very simple, there is a new method
Model.observe(name, observer), where the observer is function
observer(context, callback).
Observers are inherited by child models and it is possible to register
multiple observers for the same hook.
List of hooks:
- query
- before save
- after save
- after delete