I
I
irvdev2018-11-15 23:25:51
JavaScript
irvdev, 2018-11-15 23:25:51

How to make unique document number in MongoDB?

Hello! I'm slowly learning MongoDB. Everything seems to work out, but I can’t figure out how to implement a unique document number. It's like an id, but in addition to the id, I need a unique human-readable number (1,2,3 ..)
Ideas in the form of bicycles come to my mind, but I did not find any ready-made solutions. There are solutions on the Internet where the standard MongoDB id turns into a number. But that doesn't suit me. I need a separate id, a separate number.
I would be grateful for any constructive! Thank you)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JorJeG, 2018-11-16
@irvdev

In mongodb - Unique indexes
In mongoose schema - unique

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question