Mongo UUIDs vs ObjectId creation and performance

I am considering using UUIDs v1 for my document indexes instead of ObjectId. I am concerned about performance and uncertainty about the best way to migrate to uuids.

My performance comes from comments about ObjectIDs which are more efficient with b-tree / indexing. What performance issues am I looking at?

My other problem is a unique factor. I am creating an API for storing public documents and will eventually have to consider sharding. And there is this document from Mongo on the issues with the uniqueness and outlines of ObjectIDs.

I am not entirely clear what problems this ability to check for uniqueness between shards can cause and if it would create problems for my situation. (basically people can create documents from a website or API and search for them the same way. I'd say let's think about millions of documents for the sake of this question. I'm more worried about selections and then lots of parallel inserts).

There seems to be pros and cons for both types of IDs. Can anyone please clarify this?

+3


source to share





All Articles