If you are using only one instance of a service to talk with Mongo then you shouldn't worry as this part of Node.js is single threaded. The only thing bad that can happen is a race condition, meaning that even if the first user did the action first before the second user there is a chance that the second user gets processed first.
The feature that you are actually looking for is resource locking. As far as i know, mongodb doesn't support locking natively but you can add a locked: Boolean property on the model and check if it's locked the first thing in the transaction. It should work but I just woke up and wrote this so I might mistaken.
If you are using only one instance of a service to talk with Mongo then you shouldn't worry as this part of Node.js is single threaded. The only thing bad that can happen is a race condition, meaning that even if the first user did the action first before the second user there is a chance that the second user gets processed first.
The feature that you are actually looking for is resource locking. As far as i know, mongodb doesn't support locking natively but you can add a locked: Boolean property on the model and check if it's locked the first thing in the transaction. It should work but I just woke up and wrote this so I might mistaken.
Also ref: docs.mongodb.com/manual/faq/concur...