0

While creating new connection on Mongo Compass the UI try to discover the entire replica set topology and connect to the primary/secondary IP.

Is there a way to create a DIRECT connection to an HOST/IP+Port just like the clients api and disable the topology discovery step?

From pymongo documentation: directConnection (optional): if True, forces this client to connect directly to the specified MongoDB host as a standalone. If false, the client connects to the entire replica set of which the given MongoDB host(s) is a part

Ran S
  • 105
  • 9
  • Eventually compass will use a version of node driver that implements the directConnection option. – D. SM Dec 13 '20 at 05:03
  • What driver its using today ? https://mongodb.github.io/node-mongodb-native/3.6/api/lib_mongo_client.js.html line 155 show this flag. And I wonder how it works OK on Compass 1.23 – Ran S Dec 13 '20 at 12:18
  • 1.24.1 uses 3.6.3 it seems. – D. SM Dec 13 '20 at 14:38

2 Answers2

1

If you don't want to connect to a replicaset, use a mongodb connection string (as opposed to mongodb+srv), use a host IP / port, and drop the &replicaSet= parameter.

Belly Buster
  • 8,224
  • 2
  • 7
  • 20
  • using the base connection string (mongodb://localhost:27017) still cause the problem. In the error I can see the real IP of the mongo instance. I am using tunnel from my MAC to the Mongo instance – Ran S Dec 11 '20 at 17:51
  • When I try to connect to 127.0.0.1:27017 I get the error: getaddrinfo ENOTFOUND 10.10.0.290 – Ran S Dec 12 '20 at 17:00
0

A bug ticket was opened to Mongo on Jira https://jira.mongodb.org/browse/COMPASS-4534 The fix should be in version 1.42.2

Ran S
  • 105
  • 9