How to handle concurrent purchase attempts for the same number in a raffle system with Next.js, React, and MongoDB?
I am building a website using Next.js, React, and MongoDB Atlas. I want to implement a raffle system where a user can select and purchase a number. Once the payment is completed, the number is assigned to the user. However, I am unsure how to handle the scenario where two users click on the same number at the exact same moment, causing a conflict.