Skip to content

Commit

Permalink
feat: allow fetching by count
Browse files Browse the repository at this point in the history
  • Loading branch information
svedova committed Jan 3, 2023
1 parent f5df00f commit 440c949
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/storage/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,21 @@ const storage = {
});
},

async fetchCount(
collectionName: string,
filters?: Record<string, Filter | Primitive>
): Promise<number> {
return (
await makeRequest<{ collectionName: string; count: number }>({
url: "/app/data-storage/count",
body: {
collectionName,
filters: mapFilters(filters),
},
})
).count;
},

async fetchOne<T>(
collectionName: string,
filters?: Record<string, Filter | Primitive>
Expand Down

0 comments on commit 440c949

Please sign in to comment.