I just switched from a PHP/MySQL app with auto-incremented ID to a Go/Mongodb app with UUID.
The main drawback I noticed is that you can't use internal mongodb document's ObjectId for your queries. It makes your code a bit more complex:
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I just switched from a PHP/MySQL app with auto-incremented ID to a Go/Mongodb app with UUID.
The main drawback I noticed is that you can't use internal mongodb document's ObjectId for your queries. It makes your code a bit more complex:
With auto-increment:
With UUID:
And it's the same for
update
,remove
&upsert
.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 anObjectId
.