From 7144d889e87b229d939fa5e49128cdfb4f1f900c Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Mon, 31 Jul 2023 14:46:04 +0100 Subject: [PATCH] fix: don't clear projection --- lib/db.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/db.ts b/lib/db.ts index c062186..4c7f9ab 100644 --- a/lib/db.ts +++ b/lib/db.ts @@ -125,11 +125,11 @@ export async function fetchUserById(id: string) { .findOne( { _id: id }, { - projection: { - relations: (await hasPermissionFromSession("users/fetch/relations")) - ? 1 - : 0, - }, + projection: (await hasPermissionFromSession("users/fetch/relations")) + ? undefined + : { + relations: 0, + }, } ); } @@ -143,11 +143,11 @@ export async function fetchUsersById(ids: string[]) { .find( { _id: { $in: ids } }, { - projection: { - relations: (await hasPermissionFromSession("users/fetch/relations")) - ? 1 - : 0, - }, + projection: (await hasPermissionFromSession("users/fetch/relations")) + ? undefined + : { + relations: 0, + }, } ) .toArray();