title: How to use async/await with mongoose
body: <p>In node.js I had code like following:</p>
  
  <pre><code>mongoose.connect(dbURI, dbOptions)
  .then(() =&gt; {
          console.log("ok");
      },
      err =&gt; { 
          console.log('error: '+ err)
      }
  );
  </code></pre>
  
  <p>Now i want to do it with async/await syntax. So i could start with <code>var mcResult = await mongoose.connect(dbURI, dbOptions);</code>, afaik it will wait for operation, until it ends with any result (much like calling C function <code>read()</code> or <code>fread()</code> in syncronous mode).</p>
  
  <p>But what should I write then? What does that return to the <code>mcResult</code> variable and how to check for an error or success? Basically I want a similar snippet, but written with proper async/await syntax.</p>
  
  <p>Also I wonder because I have auto reconnect, among <code>dbOptions</code>:</p>
  
  <pre><code>dbOptions: {
    autoReconnect: true,
    reconnectTries: 999999999,
    reconnectInterval: 3000
  }
  </code></pre>
  
  <p>Would it "stuck" on <code>await</code> forever, in case if database connection is unavailble? I hope you can give me a clue on what would happen and how that would work.</p>