为 Express 网络应用程序在 Node.js 上生成唯一 ID
Generating Unique IDs on Node.js for a Express web application
我遇到了两个可能的库 node-uuid (https://www.npmjs.com/package/node-uuid) and cuid (http://usecuid.org/). Both of these from what i can see generate good collision free unique ids. However, there is the odd situation where there may be collisions as discussed in https://github.com/ericelliott/cuid/issues/22.
为了解决这个问题,我最初的想法是将它存储在 mongodb
中并寻找唯一性。有没有更好的方法来保证唯一性?
我知道它没有回答你的问题,但我正在使用以下库 https://www.npmjs.com/package/uuid and it does not have any issue open at least. And you can find why it will not be the same in here https://softwareengineering.stackexchange.com/questions/130261/uuid-collisions
我遇到了两个可能的库 node-uuid (https://www.npmjs.com/package/node-uuid) and cuid (http://usecuid.org/). Both of these from what i can see generate good collision free unique ids. However, there is the odd situation where there may be collisions as discussed in https://github.com/ericelliott/cuid/issues/22.
为了解决这个问题,我最初的想法是将它存储在 mongodb
中并寻找唯一性。有没有更好的方法来保证唯一性?
我知道它没有回答你的问题,但我正在使用以下库 https://www.npmjs.com/package/uuid and it does not have any issue open at least. And you can find why it will not be the same in here https://softwareengineering.stackexchange.com/questions/130261/uuid-collisions