plexinc / papr

MongoDB TypeScript-aware Models
https://plexinc.github.io/papr/
MIT License
442 stars 23 forks source link

Best way to store UUIDs as `_id`? #872

Open GingerAdonis opened 1 month ago

GingerAdonis commented 1 month ago

Hi! Normally I store UUIDs using Mongo's UUID function, which is more performant than storing the hexadecimal string representation. However, I'm unsure how to properly achieve this in Papr.

Could anyone point me in the right direction? Thanks.

joshuat commented 1 month ago

I think you can use the exported UUID class from the bson library.

GingerAdonis commented 1 month ago

I think you can use the exported UUID class from the bson library.

Unfortunately the UUID class is not compatible with any of the types Papr accepts for _id.