Skip to content

Nothing renews like forget

Compare
Choose a tag to compare
@broerse broerse released this 26 Jan 21:35
· 55 commits to master since this release

Important [breaking] changes in this release:

  • Don't save hasMany child ids is on by default.
  • Eventually Consistent is on by default.
  • dontsavehasmany and dontsave flags should be removed.
  • In some hasMany cases you need to specify the new option save: true on the model.

Don't save hasMany child ids

To be more in line with the normal ember data way of saving hasMany - belongsTo relationships, ember-pouch now has an option to not save the child ids on the hasMany side. This prevents the extra need to save the hasMany side. For a more detailed explanation please read the relational-pouch documentation

This new mode can be disabled for a hasMany relationship by specifying the option save: true on the relationship. An application wide setting named ENV.emberPouch.saveHasMany can also be set to true to make all hasMany relationships behave the old way.

Using this mode does impose a slight runtime overhead, since this will use db.find and database indexes to search for the child ids. The indexes are created automatically for you. But large changes to the model might require you to clean up old, unused indexes.

!Important
This mode is the default from version 5 on wards. Before that it was called dontsave and dontsavehasmany

Eventually Consistent

Following the CouchDB consistency model, we have introduced ENV.emberPouch.eventuallyConsistent. This feature is on by default. So if you want the old behavior you'll have to disable this flag.

findRecord now returns a long running Promise if the record is not found. It only rejects the promise if a deletion of the record is found. Otherwise this promise will wait for eternity to resolve.
This makes sure that belongsTo relations that have been loaded in an unexpected order will still resolve correctly. This makes sure that ember-data does not set the belongsTo to null if the Pouch replicate would have loaded the related object later on. (This only works for async belongsTo, sync versions will need this to be implemented in relational-pouch)