MongoServerSelectionError: connection timed out
at Timeout._onTimeout (D:\NodeJS\SearchEngine\node_modules\mongodb\lib\core\sdam\topology.js:438:30)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
reason: TopologyDescription {
type: 'Unknown',
setName: null,
maxSetVersion: null,
maxElectionId: null,
servers: Map { 'localhost:27017' => [ServerDescription] },
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: null
}
}
code
try { const client = await MongoClient.connect(connection.url,usermail.config_connection)
const db = client.db(connection.name);
var ecommerce=await db.collection('userTopic').find({'userDomainID': "5fb8d79cbeb8eb1218f9ebdb"}).toArray();
console.log(ecommerce); }
catch (error) { console.error(error) }