My problem: I am not sure whether that coupon does not conflict if there are many requests? What is the better approach if I dont want to use retry?
Thank you all for reading. I’m looking forward to your question and response.
Hey @Kushagra_Kesav , I have canceled this referral system due to security problem. However, I’m pleased to discuss with you more about this.
Background: We buy 3rd party coupons and insert them to our db, and then let users collect them and redeem.
“pre-saved” means that we have inserted coupons, not generating on users’ demand.
Every coupon is unique and is 1 time use. Meaning that users should not receive the same coupon if the request is duplicated or there are many requests.
Since the filter on query is just like this
So the issue is about concurrent requests and after raising this post, I realized that mongodb transaction has
perfectly handled this case for me.