title: Got the Error "MongooseServerSelectionError: Server selection timed out after 30000 ms"
body: <p>I got the Error <code>MongooseServerSelectionError: Server selection timed out after 30000 ms</code>.
  I am using MongoDB Atlas.
  I've tried changing <code>useUnifiedTopology</code>to false and my application doesn't crash, but I get the Error <code> 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.</code></p>
  <p>The whole error message:</p>
  <pre><code>MongooseServerSelectionError: Server selection timed out after 30000 ms
   {
    reason: TopologyDescription {
      type: 'ReplicaSetWithPrimary',
      setName: 'atlas-lhb3t7-shard-0',
      maxSetVersion: 1,
      maxElectionId: 7fffffff0000000000000005,
      servers: Map {
        'wolfgangtest-shard-00-02.q8jpm.mongodb.net:27017' =&gt; [ServerDescription],
        'wolfgangtest-shard-00-00.q8jpm.mongodb.net:27017' =&gt; [ServerDescription],
        'wolfgangtest-shard-00-01.q8jpm.mongodb.net:27017' =&gt; [ServerDescription]
      },
      stale: false,
      compatible: true,
      compatibilityError: null,
      logicalSessionTimeoutMinutes: null,
      heartbeatFrequencyMS: 10000,
      localThresholdMS: 15,
      commonWireVersion: 8
    }
  }
  </code></pre>
  <p>My Mongoose code:</p>
  <pre><code>const dbOptions = {
              useNewUrlParser: true,
              autoIndex: false,
              poolSize: 5,
              connectTimeoutMS: 10000,
              family: 4,
              useUnifiedTopology: true
          };
          
          mongoose.connect('mongodb+srv://Wolfgang:christian13561z@wolfgangtest.q8jpm.mongodb.net/Wolfgang?retryWrites=true&amp;w=majority', dbOptions);
          mongoose.set('useFindAndModify', false);
          mongoose.Promise = global.Promise;
  </code></pre>
  <p>How do i fix / bypass this?</p>