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();