{ _id:ObjectId, otherID:String }
{ _id:ObjectId, OtherID:ObjectId }
What’s the difference?
Please use ObjectId, various operations are more convenient than strings
I have made a more comprehensive explanation about ObjectId, you can refer to the article. If you don’t want to read it all, the answer to this question is in the Q&A section at the end.
ObjectId is easier to generate in a sharded environment... and the default _id key is an ObjectId object..
Please use ObjectId, various operations are more convenient than strings
I have made a more comprehensive explanation about ObjectId, you can refer to the article.
If you don’t want to read it all, the answer to this question is in the Q&A section at the end.
ObjectId is easier to generate in a sharded environment... and the default _id key is an ObjectId object..