Adding value to integer in firestore document

Viewed 589

I am trying to simply add to an already existing number in a firestore document. But what I am going does not work. Here is what I have:

for (let i = 0; i < transaction.debitEntries.length; i++) {
    this.transactionService.accountsCollection
        .doc(transaction.debitEntries[i].accountId)
        .update({ debitAmount: debitAmount + transaction.debitEntries[i].amount });
}

Where I am trying to add the transaction amount to the debitAmount that is already saved in the database. What am I missing?

0 Answers
Related