Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
May 24, 2024

Conversation

craigbeck
Copy link
Contributor

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.

@craigbeck craigbeck added the minor Increment the minor version when merged label May 22, 2024
@craigbeck craigbeck requested a review from ericyhwang May 22, 2024 19:13
src/Model/collections.ts Outdated Show resolved Hide resolved
src/Model/collections.ts Outdated Show resolved Hide resolved
@craigbeck craigbeck requested a review from ericyhwang May 23, 2024 19:33
@craigbeck craigbeck merged commit d40585b into master May 24, 2024
8 checks passed
@craigbeck craigbeck deleted the getValues branch May 24, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants