Answer the question
In order to leave comments, you need to log in
MongoDB. Replacing the default _id. Is it legal at all?
Good afternoon.
I am writing my first application on node.js + mongodb.
I would like some documents to have IDs of the form 0,1,2,3,4, etc. There is an idea to use the default _id field for this. In docks read that it is used for indexing. Will replacing this field cause any problems in the future? In addition to indexing, nothing is tied to it?
Answer the question
In order to leave comments, you need to log in
You can use any scalar type in the _id field - ObjectID, string, int
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question