The node.js driver, and potentially other drivers, make a handshake with the isMaster document formatted a little bit differently than what the current code expects. The ismaster|isMaster value is a boolean, instead of a number. This is causing the isMaster command to breach the proxy and reach the server, and when sent with client metadata, causes the server to respond with the error:
MongoServerSelectionError: The client metadata document may only be sent in the first isMaster
Here are examples of different drivers and how their document in this function appear:
Issue
This fixes the following issue: https://github.com/coinbase/mongobetween/issues/30
Summary
The node.js driver, and potentially other drivers, make a handshake with the
isMaster
document formatted a little bit differently than what the current code expects. Theismaster
|isMaster
value is a boolean, instead of a number. This is causing the isMaster command to breach the proxy and reach the server, and when sent with client metadata, causes the server to respond with the error:Here are examples of different drivers and how their document in this function appear:
node.js
MongoDB Shell
PyMongo
Changes
This change will make drivers that pass in boolean values for
isMaster
to be successfully intercepted.