Hello,
I need to increment a value in a collection by 1 each time a particular action occurs.
I initially thought I would retrieve the current value from the database, store it in local storage, then use an update service to increment the value back in the collection.
However, the problem with this is the potential delay between getting the current value, and then updating it with the new value (ie. increment by 1), especially when there may be multiple users all updating the same record at the same time.
I did some research, and found that mongoDB has the perfect function for this which increments a specified field in a collection by a specified amount.
It is: $inc
http://docs.mongodb.org/manual/refere...
Unfortunately I have not been able to figure out how to implement this function in my Appery backend database objects.
Can you please tell me how I can use this operator on my Appery backend objects?
Thanks.