-
Notifications
You must be signed in to change notification settings - Fork 9
feat(query-parser, shell-bson-parser, constants): add shell helpers for legacy UUID MONGOSH-2486 #594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| LegacyJavaUUID: function (u: any) { | ||
| if (u === undefined) { | ||
| // Generate a new UUID and format it. | ||
| u = new bson.UUID().toHexString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatting with @nbbeeken I think we were thinking of throwing an error here instead. This is when someone writes new LegacyJavaUUID() without a string in the quotes. Currently UUID creates a new UUID so I had initially written it to also generate a new UUID (of subtype 3).
Any other opinions on if it we should throw an error or allow it? I'll add an error throw otherwise. I'll ask Betsy on it too.
| snippet: "LegacyPythonUUID('${1:uuid}')", | ||
| }, | ||
| { | ||
| name: 'UUID', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| value: 'LegacyJavaUUID', | ||
| label: 'LegacyJavaUUID', | ||
| score: 1, | ||
| meta: 'bson-legacy-uuid', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.


MONGOSH-2486
Description
Adds
LegacyJavaUUID,LegacyCSharpUUID, andLegacyPythonUUIDhelpers to the query-parser, shell-bson-parser, and mongodb-constants. These are ways for folks to pass a UUID string in the canonical form00112233-4455-6677-8899-aabbccddeeffand have it encoded how the various legacy implementations did it. See the short history of UUIDs for more info.In the next ticket, COMPASS-9690, we'll be adding this to Compass and providing a setting to customize how we're rendering the Binary subtype 3. We won't be adding that in mongosh, we'll keep showing the format
Binary.createFromBase64('Y7mFuOjdS9qQh+RALxo/9g==', 3).https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#a-short-history-of-mongodb-uuids
Brief: UUID Support in Compass & Mongosh