I am trying out MongoDB change streams and have come across a problem related to data decoding. In my application (java) i use UUIDs for the documents i store in Mongo. When i turn on the change stream towards the collections i want to listen to, the document ids (:document_key in the change object specification) looks like this:
{"_id"=><BSON::Binary:0x31777440 type=uuid data=0xb426135aabd24af2...>}}
It is not clear to me how I am supposed to decode this back to the original UUID. If i run .to_json on the id i get this:
{“$binary”:{“base64":“rpUsTqcGSZ+YPDzebvq2aA==“,”subType”:“04”}}
Then, decoding the "base64"-field nets me the following nonsense:
,NI<<nh