title: Can't connect to my MongoDB DataBase, getting this error "Server Selection Timed Out After 3000ms" on Mongodb Compass
body: <p>This is the error that I is being shown on my terminal.</p>
  
  <pre><code>{
  message: 'connect ECONNREFUSED 127.0.0.1:27017',
    name: 'MongooseServerSelectionError',
    reason: TopologyDescription {
      type: 'Single',
      setName: null,
      maxSetVersion: null,
      maxElectionId: null,
      servers: Map { 'localhost:27017' =&gt; [ServerDescription] },
      stale: false,
      compatible: true,
      compatibilityError: null,
      logicalSessionTimeoutMinutes: null,
      heartbeatFrequencyMS: 10000,
      localThresholdMS: 15,
      commonWireVersion: null
    },
    [Symbol(mongoErrorContextSymbol)]: {}
  }
  </code></pre>
  
  <p>My Code for connecting to DataBase in this:- </p>
  
  <pre><code>const mongoose = require("mongoose");
  
  mongoose
    .connect("mongodb://localhost:27017/playground", {
      useNewUrlParser: true,
      useUnifiedTopology: true
    })
    .then(() =&gt; {
      console.log("database connected");
    })
    .catch(err =&gt; {
      console.log("Could not connect", err);
    });
  
  </code></pre>
  
  <p>Everything was working fine until I shut down my laptop. I don't know why the Mongodb compass is showing me this error "Server selection timed out after 30000 ms", I am working on the localhost, only </p>