You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
738 B

4 years ago
  1. # `whereNotIn()`
  2. The whereNotIn method filters the collection by a given key / value not contained within the given array:
  3. ```js
  4. const collection = collect([
  5. { product: 'Desk', price: 200 },
  6. { product: 'Chair', price: 100 },
  7. { product: 'Bookcase', price: 150 },
  8. { product: 'Door', price: 100 },
  9. ]);
  10. const filtered = collection.whereNotIn('price', [150, 200]);
  11. filtered.all();
  12. // [
  13. // { product: 'Chair', price: 100 },
  14. // { product: 'Door', price: 100 },
  15. // ]
  16. ```
  17. > When working with nested objects `whereNotIn()` method allows dot notated keys. E.g. `whereNotIn('product .categories', ['office-supplies', 'furniture'])`
  18. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/whereNotIn.js)