Mongosh MongoServerSelectionError - reports maximum wire version 5


I have a replica set to which I’m trying to connect using mongosh from a MacOS environment.

The replica set has 3 (three) nodes with MongoDB v3.4.
Mongosh version is 1.6.1.
NodeJS version is v12.12.0.

The connection string I’m using in order to connect is:
mongosh "mongodb://,,"

Trying to connect this way will end up with the following error:

Current Mongosh Log ID:	65606680413fe6e74ab6b665
Connecting to:		mongodb://,,
MongoServerSelectionError: Server at reports maximum wire version 5, but this version of the Node.js Driver requires at least 6 (MongoDB 3.6)

Does anyone have any idea how to solve this issue or what is the documentation that I should refer to in order to find the answer?

Thank you!

Mongosh currently supports MongoDB version 4.2+

Supported MongoDB Versions

You can use the MongoDB Shell to connect to MongoDB version 4.2 or greater.>

You can install MongoDB 4.4 using brew and use the included mongo to connect.

Thank you for your answer!

So, if my understanding is correct, I need to have a full installation of MongoDB on my local machine in order to have access to a tool that will allow connections to an older version of MongoDB?

Thank you!

On Mac I think that is correct, someone more familiar with Mac + mongodb may be able to add further comment.

On Linux I would have recommended you just install mongodb-org-shell-4.4.25 but I don’t recall seeing just an install of mongo being available for Mac or Windows.

@Florin_Trifu, just to provide some context, the error you’re getting is due to the mongosh shell using a version of the Node.js driver >= 4.2.0, which only support MongoDB 3.6+ (per NODE-3469).

Though MongoDB 3.4 reached EOL in January, 2020 if you need to interact with a cluster on this version you can use the legacy mongo shell instead of mongosh. The legacy shell is bundled with either the Enterprise or Community server, but no installation/configuration is required (just extract the mongo binary from the archive file).

1 Like