.fetch()

Fetches the entries directly from the JSON file and returns the ones that match the provided filter. Fetches and returns all the entries from the collection if no filter is provided.

fetch(filter)

// Note: Users is a collection.

Users.create({ id: 1, name: '5antos' }); // { id: 1, name: '5antos' }

Users.fetch(); // [{ id: 1, name: '5antos' }]
Users.fetch(u => u.id === 1); // { id: 1, name: '5antos' }
Users.fetch(u => u.name === 'Unnamed user'); // null

Last updated