Ask coding questions

← Back to all posts
How do I attach a unique ID to each entry in my NoSQL database?
RahulChoubey1

In my NoSQL testing program, I want to automatically attach a unique ID to each entry in my database, ie. no manual ID attachment. How would I do so?

Voters
BasToTheMax
Highwayman
RahulChoubey1
Comments
hotnewtop
ruiwenge2

try using uuid:

RahulChoubey1

@ruiwenge2 but won't that force me to insert the uuid into the db EVERY. SINGLE. TIME? And how would I handle ID duplicates?

ruiwenge2

@RahulChoubey1 well yeah of course you have to insert the uuid into the db every single time.

about duplicates, take a look here: https://stackoverflow.com/questions/1155008/how-unique-is-uuid

RahulChoubey1

@ruiwenge2 woahhh

ruiwenge2
RahulChoubey1

@ruiwenge2 also, why isn't nosql.debug doing anything?