<!DOCTYPE html>
<html>

  <head>
    <script src="https://cdn.rawgit.com/js-data/js-data/master/dist/js-data.js"></script>
    <script src="script.js"></script>
  </head>

  <body>
    <h1>Open up your console to see the output</h1>
  </body>

</html>
var store = new JSData.DS();

var Document = store.defineResource('user');

console.log('Document.inject({ title: \'How to Cook\', id: 45, author: \'John Anderson\' })', Document.inject({
  title: 'How to Cook',
  id: 45,
  author: 'John Anderson'
}));
console.log('Document.inject({ title: \'How to Eat\', id: 46, author: \'Sally Jane\' })', Document.inject({
  title: 'How to Eat',
  id: 46,
  author: 'Sally Jane'
}));

console.log('Document.filter()', Document.filter());

console.log('Document.ejectAll({ where: { author: \'Sally Jane\' } })', Document.ejectAll({
  where: {
    author: 'Sally Jane'
  }
}));

console.log('Document.filter()', Document.filter());
## DS#ejectAll(resourceName[, params][, options])

Eject all matching items of the specified type from the data store. Ejection only removes items from the data store and does not attempt to destroy items via an adapter.

Returns any ejected items.

###### Arguments

| name | type | description |
| ---- | ---- | ----------- |
| resourceName | string | The name of the resource to use. Unnecessary if using the resource directly. |
| params | object | Query parameters for selecting which items to eject. Default: `{}`. See [Query Syntax](http://www.js-data.io/docs/query-syntax) for how to filter, sort, limit and offset. |
| options | object | Configuration options. |
| options.notify | boolean | Whether to call the `beforeEject` and `afterEject` hooks and emit the `DS.eject` event. Default: `true`. |

###### Examples

```js
Document.filter('document'); // [ { title: 'How to Cook', id: 45, author: 'John Anderson' },
                             //   { title: 'How to Eat', id: 46, author: 'Sally Jane' } ]

// See Method Variants section below for different ways to call DS#ejectAll
Document.ejectAll({ where: { author: 'Sally Jane' } });

Document.filter(); // [ { title: 'How to Cook', id: 45, author: 'John Anderson' } ]
```

Eject all items of the specified type from the data store.

```js
Document.filter('document');   // [ { title: 'How to Cook', id: 45, author: 'John Anderson' },
                         //   { title: 'How to Eat', id: 46, author: 'Sally Jane' } ]

// See Method Variants section below for different ways to call DS#ejectAll
Document.ejectAll();
Document.filter(); // [ ]
```