DS#destroyAll(resourceName[, params][, options])

The "D" in "CRUD". Delegate to the destroyAll method of whichever adapter is being used and eject the matching items from the data store.

Returns a promise.

resourceNamestringThe name of the resource to use. Unnecessary if using the resource directly.
paramsobjectQuery parameters for selecting which items to destroy. Default: {}.
optionsobjectConfiguration options. Also passed through to the adapter and (conditionally) to DS.ejectAll.
options.adapterstringOverride the default adapter.
options.beforeDestroyfunctionOverride the default beforeDestroy hook.
options.afterDestroyfunctionOverride the default afterDestroy hook.
options.eagerEjectfunctionWhether to eject the item from the data store without waiting for a response from the adapter. If an error is thrown the item will be re-injected into the store. Default: false.
options.notifyfunctionWhether to call the beforeDestroy and afterDestroy hooks and emit the DS.beforeDestroy and DS.afterDestroy events. Default: true.
Live Demo


Method Variants

You can call DS#destroyAll multiple ways:

  • DS#destroyAll(resourceName[, params][, options])
  • Resource#destroyAll([params][, options]) - Where Resource was created by DS#defineResource


Need help?

Want more examples or have a question? Ask on the Slack channel or post on the mailing list then we'll get your question answered and probably update this wiki.