[CSHARP-4786] Fix uuidhelper.js to work with mongosh Created: 12/Sep/23  Updated: 28/Oct/23  Resolved: 28/Sep/23

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.22.0

Type: Improvement Priority: Unknown
Reporter: James Kovacs Assignee: James Kovacs
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

uuidhelpers.js were written for the legacy mongo shell and use functions not available in mongosh. Update uuidhelpers.js to be compatible with mongosh.



 Comments   
Comment by Githook User [ 27/Sep/23 ]

Author:

{'name': 'James Kovacs', 'email': 'jkovacs@post.harvard.edu', 'username': 'JamesKovacs'}

Message: CSHARP-4786: Added shim to uuidhelpers.js so that it works in both the old mongo shell as well as the new mongosh shell. (#1175)
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/13267f8f2c54f85c7aec5e7dad33aa0914352c92

Comment by James Kovacs [ 12/Sep/23 ]

Based on some quick tests, the following should make uuidhelpers.js work in the old mongo shell as well as the new mongosh shell.

if (BinData.prototype.base64 === undefined && BinData.prototype.subtype === undefined) {
    BinData.prototype.base64 = function() { return this.buffer.base64Slice(); };
    BinData.prototype.subtype = function() { return this.sub_type; };
}

Generated at Wed Feb 07 21:49:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.