Mongo DB indexing using string

Hi,

We are creating a new collection in MongoDB and considering our options to see if the ID column should use the string datatype to store data versus the UUID with the Binary 0x04 subtype. Is there any performance gain in using UUID over a string datatype? From MongoDB articles, I don’t see a reason why the datatype can affect index performance.

i personally don’t think indexing performance is a big thing here. What i care about would be which type can better fit my requirements (e.g. uniqueness)

That being said, generally shorter fields in bytes means faster index.

2 Likes