mongoose-increment
mongoose-increment copied to clipboard
Duplicate sequence number is possible if model is saved in concurrency
Bug, feature request, or proposal:
bug
What is the expected behavior?
Unique sequence number in all cases
What is the current behavior?
If two or more models are saved at the same time, they will get duplicate sequence number
What is the use-case or motivation for changing an existing behavior?
Incrementation should create unique sequence number
Is there anything else we should know?
Since there is no transaction locking in mongodb, I dont know what would be a good way to fix or prevent this