toID() method sorts generated id and returns it in a non-uuid format (eg. 11e7-a9d1-48fb57a0-bcd7-81ecee726a36).
Once its saved in Postgres UUID column Postgres will re-format this value into UUID canonical representation (11e7a9d1-48fb-57a0-bcd7-81ecee726a36).
In terms of Postgres it doesn't matter in which format the uuid will be passed. It will accept both of them.
However, this can be a problem when generated id is used both in a Postgres DB and different storage (in my case it is Mongo).
What I'd like to suggest is to change the format of the id generated by toID() to be exact as UUID canonical representation.
toID()method sorts generated id and returns it in a non-uuid format (eg.11e7-a9d1-48fb57a0-bcd7-81ecee726a36).Once its saved in Postgres
UUIDcolumn Postgres will re-format this value into UUID canonical representation (11e7a9d1-48fb-57a0-bcd7-81ecee726a36).In terms of Postgres it doesn't matter in which format the uuid will be passed. It will accept both of them.
However, this can be a problem when generated id is used both in a Postgres DB and different storage (in my case it is Mongo).
What I'd like to suggest is to change the format of the id generated by
toID()to be exact as UUID canonical representation.