js-data

Respect Your Data

Give your data the treatment it deserves with a framework-agnostic, datastore-agnostic JavaScript ORM built for ease of use and peace of mind. Works in Node.js and in the Browser.

Get Started

DS#eject

DS#eject(resourceName, id[, options])

Eject from the store the item of the specified resource that has the given primary key. Ejection only removes items from the data store and does not attempt to destroy items via an adapter.

Returns the ejected item if it was ejected.

Arguments
nametypedescription
resourceNamestringThe name of the resource to use. Unnecessary if using the resource directly.
idstring or numberThe primary key of the item to eject.
optionsobjectConfiguration options.
options.notifybooleanWhether to call the beforeEject and afterEject hooks and emit the DS.eject event. Default: true.
Live Demo

👍

Method Variants

You can call DS#eject multiple ways:

  • DS#eject(resourceName, id[, options])
  • Resource#eject(id[, options]) - Where Resource was created by DS#defineResource
  • Instance#DSEject([, options]) - Where Instance is an instance of a Resource. Note this ejects the item from the store, but you still have a reference to the object, so the object won't get garbage collected just yet.

📘

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.

Updated less than a minute ago

DS#eject


DS#eject(resourceName, id[, options])

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.