I am very new to couchdb and I wonder how I can create an ID that looks like.
Employee:DBX-**0001**-SP
number 0001 must be unique and sequential. How can I achieve something like this in couchdb? I searched everything and I cannot find a simple solution.
It would be better if I could generate the serial part in couchdb and not on the client side to avoid collisions during replication.
Currently, the solution that I have is that I will bring the document I saved, which looks like this {"_id": "EmployeeAutoIncrement", value: 1} after extraction, I increase the value and send it back to the server if those are successful, then I return a new value with an extra value and use it as an Auto Increment value to participate in the Employee ID: DBX- AUTO_INCREMENT_VALUE_HERE -SP
The problem is that if two people access EmployeeAutoIncrement at the same time, and they both update it, it will not cause conflicts? In addition, if one person makes a request, and they go offline, then they return to the network and then do not conflict?
source share