User2096382003 posted
im new to node.js and am trying to connect to a mongodb database/collection.
following the info here:
https://www.mongodb.com/blog/post/quick-start-nodejs-mongodb--how-to-get-connected-to-your-database
i get this error:-
(node:19164) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient
constructor.
when i add { useUnifiedTopology: true } to the constructor i then get this error:-
MongoServerSelectionError: connection <monitor> to 63.33.132.230:27017 closed
at Timeout._onTimeout (C:\Projects\NodeJs\node_modules\mongodb\lib\core\sdam\topology.js:430:30)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
setName: null,
maxSetVersion: null,
maxElectionId: null,
servers: Map {
'cluster0-shard-00-00-kjy43.mongodb.net:27017' => [ServerDescription],
'cluster0-shard-00-01-kjy43.mongodb.net:27017' => [ServerDescription],
'cluster0-shard-00-02-kjy43.mongodb.net:27017' => [ServerDescription]
},
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: null
}
}
does anyone know what this is referring to?
the example im trying to run from the mongo db website should just display a list of databases in my cluster...