How can we convert BSON binary with subtype=0x03 to subtype=0x03

You can find in the BSON specification that a binary of subtype 03 (UUID Old) is deprecated and we should use subtype 04 (UUID).

bsonspec.org

How can we convert a 03 binary to a 04 binary? We can find the method to do that in mongo-python-driver:

https://github.com/mongodb/mongo-python-driver/blob/c70071df1db841964ecf517893d2c23f3cb51764/bson/binary.py#L256

According to the above code, we can convert a 03 UUID binary to a 04 UUID binary by reversing the first 8 bytes and the last 8 bytes separately.

Good luck.