* Return error if connector does not implement (Amir Jafarian)
* kvao: return 404 when expiring unknown key (Miroslav Bajtoš)
* Update doc for `validatesFormatOf` (Amir Jafarian)
* Implement KeyValue API and memory connector (Miroslav Bajtoš)
* Fix test case typo (Amir Jafarian)
* Remove unused variables in model.js (Amir Jafarian)
* Add test for updateOrCreate (Amir Jafarian)
* Declare `definition` (Amir Jafarian)
* Add test to catch invalid date property (Supasate Choochaisri)
Models attached to a KeyValue connector get the following *static*
methods:
Color.set(key, value);
Color.set(key, value, ttl);
Color.set(key, value, { ttl: ttl });
Color.get(key);
Color.expire(key, ttl);
* Ensure stable order of items in DAO.find() (Miroslav Bajtoš)
* give options to validators #984 (RobinBiondi)
* Update datasource.js (Amir Jafarian)
* Give warning if PK is changed in hooks (Amir Jafarian)
* Persist changes on parent for embedsOne (Dimitris Halatsis)
Allow direct save of changes on embedded model to be persisted on
parent document.
Person.embedsOne(Address);
Person.findById(someId)
.then(function(p){
var address = p.addressItem();
address.street = 'new street'
// This will now persist changes on parent document
return address.save();
})
The setting controls the strict mode used for embedded property types,
for example the type of "address" property in this model definition:
modelBuilder.define('TestEmbedded', {
name: 'string',
address: {
street: 'string',
},
});
[back-port of #955]
create() triggers
- before save
- after save
updateById() triggers
- before save
- after save
destroy() triggers
- before delete
- after delete
The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.
Limitations:
- `before save` & `after save` hooks don't provide `ctx.isNewInstance`
- async validations are not supported yet
- `persist` and `loaded` hooks are not triggered at all
- `before delete` hook does not provide `ctx.where` property and
it's not possible to change the outcome of `destroy()` using this
hook. Note that regular DAO does support this.
- updating embedded instances triggers update of the parent (owning)
model, which is correct and expected. However, the context provided
by `before save` and `after save` hooks on the parent model is sort of
arbitrary and may include wrong/extra data. The same probably applies
to the scenario when deleting embedded instances triggers update of
the parent model.
[back-port of #911]
create() triggers
- before save
- after save
udpate() triggers
- before save
- after save
destroy() triggers
- before delete
- after delete
The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.
[back-port of #904]