0

Can someone explain why the error was thrown and how to fix it in detail?

reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    logicalSessionTimeoutMinutes: undefined
  }
  • Is the **mongod** process running? – tromgy Jan 13 '22 at 03:34
  • Yes, running this issue has been fixed by adding { family : 4 } in mongoose connect. Thanks! – Praveen Samuel J Jan 13 '22 at 04:33
  • **Working Code** `mongoose.connect('mongodb://localhost:27017/test',{family: 4, useNewUrlParser: true, useUnifiedTopology: true}).then(() => app.listen(5000, () => {console.log('Port 5000 is running...')})).catch(error => console.log(error));` – Praveen Samuel J Jan 13 '22 at 04:34

0 Answers0