I have an app with sweepstakes. The user simply has to click a button, a request for an API is sent to Express, the user is entered as participating in the MongoDB database and will respond to the user about the successful execution of the request.
But if you send two such requests at the same time, the user can get into the same distribution two or more times.
How can this be avoided? Is there a good way to store an array with users for whom such a request is already being processed? And if the varieties of such requests are many?