Improved a bit of the speed of the application

This commit is contained in:
Tiago Ribeiro
2024-12-11 18:32:29 +00:00
parent 76cbf8dc41
commit ce35ba71f4
6 changed files with 148 additions and 163 deletions

View File

@@ -173,3 +173,9 @@ export const getGroupsByEntities = async (ids: string[]): Promise<WithEntity<Gro
{ $match: { entity: { $in: ids } } },
...addEntityToGroupPipeline
]).toArray()
export const countGroups = async () =>
await db.collection("groups").countDocuments({})
export const countGroupsByEntities = async (ids: string[]) =>
await db.collection("groups").countDocuments({ entity: { $in: ids } })