Hi! I’ve been using the Go MongoDB driver for quite some time, but I’ve always encountered the limitation of not being able to store UUID objects directly. To work around this, I’ve been using this excellent decoder & encoder (https://gist.github.com/SupaHam/3afe982dc75039356723600ccc91ff77).
However, with the new v2 version of the driver, I can no longer use this due to the removal of some packages like bsoncodec, bsonrw, and bsontype.
So, I was wondering if there are any plans to include support for UUID object serialization in the new version of the driver? That would be amazing!
Hi @Angelsc, thanks for the question! bson.NewRegistryBuilder was deprecated in 1.x by bson.NewRegistry(). Otherwise, for v2 bsoncodec, bsonrw, and bsontype have been merged into the bson package to simplify imports. Here is the updated version of your gist:
Hello!
I’ve been busy these days and hadn’t had the chance to try the registry. It’s exactly what I needed. Thank you so much! Now I can start using the v2 of the driver!
I have a question out of curiosity. Is there any plan to integrate native UUID Encode/Decode into the new version of the driver at some point? That would be awesome!