diff --git a/app/lib/actions/locationActions.ts b/app/lib/actions/locationActions.ts index 7accab4..be3fc07 100644 --- a/app/lib/actions/locationActions.ts +++ b/app/lib/actions/locationActions.ts @@ -264,6 +264,24 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu }, }, }, + { + $addFields: { + _id: { $toString: "$_id" }, + bills: { + $map: { + input: "$bills", + as: "bill", + in: { + _id: { $toString: "$$bill._id" }, + name: "$$bill.name", + paid: "$$bill.paid", + payedAmount: "$$bill.payedAmount", + hasAttachment: "$$bill.hasAttachment", + }, + }, + }, + } + }, { $project: { "_id": 1, @@ -274,12 +292,7 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu // "yearMonth": 1, "yearMonth.year": 1, "yearMonth.month": 1, - // "bills": 1, - "bills._id": 1, - "bills.name": 1, - "bills.paid": 1, - "bills.payedAmount": 1, - "bills.hasAttachment": 1, + "bills": 1, // "bills.attachment": 0, // "bills.notes": 0, // "bills.barcodeImage": 1,