.fetchMany()

Fetches the entries directly from the JSON file and returns the ones that match the provided filter.

fetchMany(filter)

Parameter

Description

filter

Callback

Function to test each element of the array. Return a value that coerces to true to keep the element, or to false otherwise

Returns

Description

Entries that match the filter

// Note: Users is a collection.

Users.createBulk([
  { name: 'Peter', age: 20 },
  { name: 'Henry', age: 18 },
  { name: 'John', age: 15 }
]);

Users.fetchMany(user => user.age > 18); // [{ name: 'Peter', age: 20 }, { name: 'Henry', age: 18 }] 

Last updated