[SOLVED] - Meteor 2.7.3 does not connect to a local mongodb

After upgrading to meteor 2.7.3 it cannot connect to a local mongodb. Here is the connection string:

export MONGO_URL=“mongodb://localhost:27017/mydb”
export MONGO_DB=“mydb”

Other applications can connect to that database and I can access it using Robo 3T, but when I start the meteor, it throws an exception:

W20220917-03:15:33.500(3)? (STDERR) /Users/auser/.meteor/packages/meteor-tool/.2.7.3.w1hpwd.s2a1k++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:313
W20220917-03:15:33.516(3)? (STDERR) throw(ex);
W20220917-03:15:33.516(3)? (STDERR) ^
W20220917-03:15:33.516(3)? (STDERR)
W20220917-03:15:33.517(3)? (STDERR) MongoServerSelectionError: getaddrinfo ENOTFOUND mongodb
W20220917-03:15:33.517(3)? (STDERR) at Timeout._onTimeout (/Users/auser/.meteor/packages/npm-mongo/.4.3.1.1aaovu6.2270g++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb/lib/sdam/topology.js:312:38)
W20220917-03:15:33.517(3)? (STDERR) at listOnTimeout (internal/timers.js:557:17)
W20220917-03:15:33.517(3)? (STDERR) at processTimers (internal/timers.js:500:7) {
W20220917-03:15:33.517(3)? (STDERR) reason: TopologyDescription {
W20220917-03:15:33.517(3)? (STDERR) type: ‘ReplicaSetNoPrimary’,
W20220917-03:15:33.518(3)? (STDERR) servers: Map(1) {
W20220917-03:15:33.518(3)? (STDERR) ‘mongodb:27017’ => ServerDescription {
W20220917-03:15:33.518(3)? (STDERR) _hostAddress: HostAddress { isIPv6: false, host: ‘mongodb’, port: 27017 },
W20220917-03:15:33.518(3)? (STDERR) address: ‘mongodb:27017’,
W20220917-03:15:33.518(3)? (STDERR) type: ‘Unknown’,
W20220917-03:15:33.518(3)? (STDERR) hosts: ,
W20220917-03:15:33.518(3)? (STDERR) passives: ,
W20220917-03:15:33.519(3)? (STDERR) arbiters: ,
W20220917-03:15:33.519(3)? (STDERR) tags: {},
W20220917-03:15:33.519(3)? (STDERR) minWireVersion: 0,
W20220917-03:15:33.519(3)? (STDERR) maxWireVersion: 0,
W20220917-03:15:33.519(3)? (STDERR) roundTripTime: -1,
W20220917-03:15:33.519(3)? (STDERR) lastUpdateTime: 610977873,
W20220917-03:15:33.520(3)? (STDERR) lastWriteDate: 0,
W20220917-03:15:33.520(3)? (STDERR) error: MongoNetworkError: getaddrinfo ENOTFOUND mongodb
W20220917-03:15:33.520(3)? (STDERR) at connectionFailureError (/Users/auser/.meteor/packages/npm-mongo/.4.3.1.1aaovu6.2270g++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb/lib/cmap/connect.js:381:20)
W20220917-03:15:33.520(3)? (STDERR) at Socket. (/Users/auser/.meteor/packages/npm-mongo/.4.3.1.1aaovu6.2270g++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mongodb/lib/cmap/connect.js:301:22)
W20220917-03:15:33.520(3)? (STDERR) at Object.onceWrapper (events.js:520:26)
W20220917-03:15:33.520(3)? (STDERR) at Socket.emit (events.js:400:28)
W20220917-03:15:33.520(3)? (STDERR) at emitErrorNT (internal/streams/destroy.js:106:8)
W20220917-03:15:33.520(3)? (STDERR) at emitErrorCloseNT (internal/streams/destroy.js:74:3)
W20220917-03:15:33.521(3)? (STDERR) at processTicksAndRejections (internal/process/task_queues.js:82:21)
W20220917-03:15:33.521(3)? (STDERR) }
W20220917-03:15:33.521(3)? (STDERR) },
W20220917-03:15:33.521(3)? (STDERR) stale: false,
W20220917-03:15:33.521(3)? (STDERR) compatible: true,
W20220917-03:15:33.521(3)? (STDERR) heartbeatFrequencyMS: 10000,
W20220917-03:15:33.521(3)? (STDERR) localThresholdMS: 15,
W20220917-03:15:33.521(3)? (STDERR) setName: ‘meteor’,
W20220917-03:15:33.522(3)? (STDERR) maxSetVersion: 3,
W20220917-03:15:33.522(3)? (STDERR) maxElectionId: ObjectId {
W20220917-03:15:33.522(3)? (STDERR) [Symbol(id)]: Buffer(12) [Uint8Array] [
W20220917-03:15:33.522(3)? (STDERR) 127, 255, 255, 255, 0,
W20220917-03:15:33.522(3)? (STDERR) 0, 0, 0, 0, 0,
W20220917-03:15:33.522(3)? (STDERR) 0, 25
W20220917-03:15:33.522(3)? (STDERR) ]
W20220917-03:15:33.522(3)? (STDERR) },
W20220917-03:15:33.522(3)? (STDERR) commonWireVersion: 9,
W20220917-03:15:33.523(3)? (STDERR) logicalSessionTimeoutMinutes: undefined
W20220917-03:15:33.523(3)? (STDERR) }
W20220917-03:15:33.523(3)? (STDERR) }

I identified the root cause of the problem, but not sure how to fix it yet. I am accessing the database over ssh tunnel. Meteor connects to that database, but then I guess, it receives the db configuration from the database itself, where the host name is different. Then it decides that the db configuration was updated and tries to connect to the database using the remote host name (“mongodb”), which is not reachable. Any ideas how to fix this?

I found the cause of the problem:

  • useUnifiedTopology is not an option anymore, it defaults to true.

I need to set it to false.