derbyjs / racer

Realtime model synchronization engine for Node.js
1.18k stars 116 forks source link

Add getValues method for fetching array of docs from collection #306

Closed craigbeck closed 3 months ago

craigbeck commented 3 months ago

Found a pattern of using filter with a null filter function in production code that was used to get an array of collection values e.g.

const users = model.filter('users', null).get() || [];

This pattern is unintuitive and highlighted missing functionality to get the collection values.

getValues returns an array of docs, and ensures an empty array when no values at path.