DEV Community

Discussion on: From monolith to cloud: Auto Increment to UUID

Collapse
 
bgadrian profile image
Adrian B.G. • Edited

Yes because ObjectID is a BSON object, and adds more text along the way.

You can use other types, like a string with a UUID, but you have to provide the _id at insert and you have to be sure they are unique. MongoDB will add an _id only if is missing and it will be an ObjectId.