optimizing DB projections

This commit is contained in:
Knee Cola
2025-11-23 11:59:06 +01:00
parent fcf3c447d1
commit 1995ad9de9
4 changed files with 41 additions and 21 deletions

View File

@@ -38,6 +38,15 @@ export const fetchBarcodeDataForPrint = withUser(async (user: AuthenticatedUser,
userId, // ensure data belongs to authenticated user
"yearMonth.year": year,
"yearMonth.month": month
}, {
// project only necessary fields
projection: {
name: 1,
bills: 1,
barcodeImage: 1,
hub3aText: 1,
payedAmount: 1
}
})
.toArray();