Problem Statement/Rationale
In both Data Explorer and Compass, inserting Binary('mkaTHwEZhaBQj+u1a3D3gA==', 3) using the aggregation pipeline's $addFields stage displays Binary('bWthVEh3RVpoYUJRait1MWEzRDNnQT09', 3). Using $out to persist the value to the collection inserts the latter as well. This seems wrong, because the base64 encoded data that was specified to be inserted is a valid UUID in the JAVA_LEGACY representation, but the inserted binary data is not. It is 24 bytes long instead of 16 bytes, but still has the subtype set to 3, so when the driver tries to decode it, there's an exception thrown (I have tried this with the Java driver, but presumably the behavior for other drivers is the same).{}
Steps to Reproduce
Try to insert the Binary(..., 3) data mentioned above (or any other base64 encoded subtype 3 value that's a valid UUID) and check the data in the collection post insert.
Expected Results
That there be no implicit conversion from base64 to some other representation in the insert process.
Actual Results
That there is some conversion going on, leading to the loss of data.
Additional Notes
Data Explorer is using compass libraries, so this is being observed there as well.