I am currently using Dynamodb as database and NodeJS as backend. For every user, whenever I receive a request, I fetch that user's data from database, do some computation on the data at backend and at then end of request I update the data in the database.
The issue is that when a single user makes multiple requests at the same time, only some of updates are written on the database while the others are lost. Is there any way I can fix this issue.
For example, lets say I have a counter for each user and on every request I provide a value with which the counter will be incremented. So if I send 5 requests at the same time with value as 5, then the counter should increment by 25 but instead it only does with 10 or 15
I don't mind changing the database to mongodb if it can solve this issue