[COMPASS-5726] Allow displaying bson binary data where the payload is invalid for the subtype Created: 12/Apr/22  Updated: 29/Oct/23  Resolved: 13/Apr/22

Status: Closed
Project: Compass
Component/s: CRUD
Affects Version/s: 1.31.1
Fix Version/s: 1.31.2

Type: Bug Priority: Major - P3
Reporter: Rhys Howell Assignee: Sergey Petushkov
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-04-12 at 2.37.12 PM.png     PNG File Screen Shot 2022-04-12 at 2.38.22 PM.png    
Documentation Changes: Not Needed
Sprint: Iteration Yonkers

 Description   

Reported on github:
https://github.com/mongodb-js/compass/issues/2974

Example document which errors Compass now:

"invalid-uuid": {
  "$binary": "120=",
  "$type": "4"
}

In previous versions of Compass (using 1.21.2 for reference) we would render binary fields which have invalid payload for the corresponding $type as follows:

In current Compass this document results in the crud view failing to render:

What's happening is the `payload`, or `$binary`, of the field does not match the 36 character UUID format (UUID is denoted by the `$type` = 4). https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/#mongodb-bsontype-Binary
I'm thinking in the recent changes in this area we may have updated how these fields are rendered or parsed with a new bson version and in doing so made the validation more strict thus causing the runtime render error.
We should allow for displaying these invalid documents as they can exist in a database.

An example document in this format that displays this error is in the `test.all_types` in the Compass Data Sets deployment.


Generated at Wed Feb 07 22:40:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.