From d37951d26708f1f9c961a0d9255b2854cbde764b Mon Sep 17 00:00:00 2001 From: koresar Date: Wed, 15 May 2024 21:03:09 +1000 Subject: [PATCH] fix: use the last most record in the DB as the balance snapshot upper boundary --- src/Book.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Book.ts b/src/Book.ts index 8d1a5e4..ba84288 100644 --- a/src/Book.ts +++ b/src/Book.ts @@ -22,7 +22,6 @@ const GROUP = { _id: null, balance: { $sum: { $subtract: ["$credit", "$debit"] } }, notes: { $sum: 1 }, - lastTransactionId: { $max: "$_id" }, }, }; @@ -110,6 +109,9 @@ export class Book