From e927499afcd86ea19ceb17484db5a6d36a7478cf Mon Sep 17 00:00:00 2001 From: Dan Aprahamian Date: Tue, 12 Nov 2019 18:50:22 -0500 Subject: [PATCH] fix(encryption): respect bypassAutoEncryption B/c we no longer flatten the autoEncryption options (to avoid a nasty recursive bug when you pass an external keyVault client) we need to check in the right place for the bypassAutoEncryption option --- lib/core/wireprotocol/command.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/wireprotocol/command.js b/lib/core/wireprotocol/command.js index 09ea788311..bb7637ed8a 100644 --- a/lib/core/wireprotocol/command.js +++ b/lib/core/wireprotocol/command.js @@ -145,7 +145,9 @@ function supportsOpMsg(topologyOrServer) { } function _cryptCommand(server, ns, cmd, options, callback) { - const shouldBypassAutoEncryption = !!server.s.options.bypassAutoEncryption; + const shouldBypassAutoEncryption = !!( + server.s.options.autoEncryption && server.s.options.autoEncryption.bypassAutoEncryption + ); const autoEncrypter = server.autoEncrypter; function commandResponseHandler(err, response) { if (err || response == null) {