Skip to content

Commit

Permalink
fix(NODE-4516): attempt to use exported BSON
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Aug 19, 2022
1 parent f87e575 commit 6b7ba28
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 68 deletions.
3 changes: 2 additions & 1 deletion bindings/node/lib/autoEncrypter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = function (modules) {
const MongocryptdManager = require('./mongocryptdManager').MongocryptdManager;
const MongoClient = modules.mongodb.MongoClient;
const MongoError = modules.mongodb.MongoError;
const BSON = modules.mongodb.BSON;
const cryptoCallbacks = require('./cryptoCallbacks');

/**
Expand Down Expand Up @@ -91,7 +92,7 @@ module.exports = function (modules) {
*/
constructor(client, options) {
this._client = client;
this._bson = options.bson || client.topology.bson;
this._bson = options.bson || BSON || client.topology.bson;
this._bypassEncryption = options.bypassAutoEncryption === true;

this._keyVaultNamespace = options.keyVaultNamespace || 'admin.datakeys';
Expand Down
3 changes: 2 additions & 1 deletion bindings/node/lib/clientEncryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = function (modules) {
const collectionNamespace = common.collectionNamespace;
const promiseOrCallback = common.promiseOrCallback;
const StateMachine = modules.stateMachine.StateMachine;
const BSON = modules.mongodb.BSON;
const cryptoCallbacks = require('./cryptoCallbacks');
const { promisify } = require('util');

Expand Down Expand Up @@ -99,7 +100,7 @@ module.exports = function (modules) {
*/
constructor(client, options) {
this._client = client;
this._bson = options.bson || client.topology.bson;
this._bson = options.bson || BSON || client.topology.bson;
this._proxyOptions = options.proxyOptions;
this._tlsOptions = options.tlsOptions;

Expand Down
119 changes: 59 additions & 60 deletions bindings/node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions bindings/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"socks": "^2.6.1"
},
"devDependencies": {
"bson": "^4.6.4",
"chai": "^4.3.6",
"chai-subset": "^1.6.0",
"chalk": "^4.1.2",
Expand All @@ -51,7 +50,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jsdoc-to-markdown": "^7.1.1",
"mocha": "^9.2.0",
"mongodb": "^4.6.0",
"mongodb": "^4.9.0",
"node-gyp": "^8.4.1",
"prebuild": "^11.0.2",
"prettier": "^2.5.1",
Expand Down

0 comments on commit 6b7ba28

Please sign in to comment.