[DRIVERS-411] Add a new uuidRepresentation value, "binary" Created: 30/Aug/17  Updated: 28/Oct/23  Resolved: 07/Jun/18

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Bernie Hackett Assignee: Bernie Hackett
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

This ticket only applies to, I believe, the Python, Java, and .NET drivers.

When a document returned from the database includes values of type BSON Binary with subtype 4, drivers that support native UUID types decode those values to their native UUID type with no changes to the order of the bytes returned by the server, ignoring uuidRepresentation. If the application has set uuidRepresentation to "standard" the value will be encoded back to BSON Binary with subtype 4 and round trip properly. If the application has set uuidRepresentation to some other value (or used the default, which is driver specific) the encoder will encode the value to BSON binary subtype 3, and possibly change its byte order, when round tripped. The problem gets worse when the database returns values of both BSON binary subtype 3 and subtype 4 in a single document (this could be common with change streams which return a subtype 4 BSON Binary as part of the resumeToken value).

To solve this problem I propose we add a new uuidRepresentation, "binary". When uuidRepresentation is set to "binary" the driver decodes BSON Binary with subtype 3 or 4 to Binary with the given subtype instead of decoding to the driver's native UUID type. This setting can be used to reliably round trip UUIDs regardless of their original format.



 Comments   
Comment by Bernie Hackett [ 23/Feb/18 ]

I think we can close this. The use case I had for it was resolved by the server in 3.6.

Generated at Thu Feb 08 08:21:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.