diff --git a/libraries/access-token-encryptor/package.json b/libraries/access-token-encryptor/package.json index 6afbc41c1d..5c77dbbd05 100644 --- a/libraries/access-token-encryptor/package.json +++ b/libraries/access-token-encryptor/package.json @@ -21,9 +21,6 @@ "dependencies": { "lodash": "^4.17.21" }, - "peerDependencies": { - "mongodb": "*" - }, "devDependencies": { "chai": "^4.3.6", "mocha": "^10.2.0", diff --git a/libraries/access-token-encryptor/scripts/helpers/re-encrypt-tokens.js b/libraries/access-token-encryptor/scripts/helpers/re-encrypt-tokens.js index df65836c23..e9ab65dce5 100644 --- a/libraries/access-token-encryptor/scripts/helpers/re-encrypt-tokens.js +++ b/libraries/access-token-encryptor/scripts/helpers/re-encrypt-tokens.js @@ -1,4 +1,3 @@ -const { ReadPreference } = require('mongodb') const _ = require('lodash') const { formatTokenUsageStats } = require('./format-usage-stats') @@ -26,12 +25,14 @@ async function reEncryptTokens(accessTokenEncryptor, encryptedJson) { * @param {AccessTokenEncryptor} accessTokenEncryptor * @param {Collection} collection * @param {Object} paths + * @param {Object} queryOptions * @return {Promise<{}>} */ async function reEncryptTokensInCollection({ accessTokenEncryptor, collection, paths, + queryOptions, }) { const { collectionName } = collection const stats = {} @@ -56,7 +57,7 @@ async function reEncryptTokensInCollection({ const cursor = collection.find( {}, { - readPreference: ReadPreference.secondaryPreferred, + ...queryOptions, projection, } ) diff --git a/package-lock.json b/package-lock.json index c9b1fe9bad..1d341ceb29 100644 --- a/package-lock.json +++ b/package-lock.json @@ -90,9 +90,6 @@ "mocha": "^10.2.0", "sandboxed-module": "^2.0.4", "typescript": "^5.0.4" - }, - "peerDependencies": { - "mongodb": "*" } }, "libraries/eslint-plugin": {