Hello! I have two entities:
Cash documents. The cash documents represent transactions made by the user; either deposits or withdrawals. I would like to keep an updated balance of a given user without going through every
Cash document and get the current balance, with two decimal point.
My current approach is to update the user everytime a cash transaction is made, but I fear that in a more concurrent enviroment I will face problems with CAS (the
User object has more properties than the cash balance, and it is updated frequently).
I have been reading Couchbase documentation, and there are atomic counters in the Node SDK (see here), which would solve my issue, but it looks like they only support 64-bit integer values.
What is the correct approach (if there’s any) to achieve the requirements I am looking for? I am currently using the Community Edition 4.1 and the SDK version 2.2.4.