title: DeprecationWarning: `ensureIndex()` is deprecated in Mongoose >= 4.12.0, use `createIndex()` instead
body: <p>hello I have created node application it was working good but from last 2 days I got this error
  I have tried to upgrade mongoose but still same error</p>
  
  <blockquote>
    <p>DeprecationWarning: <code>ensureIndex()</code> is deprecated in Mongoose >= 4.12.0, use <code>createIndex()</code> instead</p>
  </blockquote>
  
  <p>because of this my application has stopped working</p>
  
  <p>here my code to connect with mongodb</p>
  
  <pre><code>mongoose.connect(config.mongo.uri, {useMongoClient: true});
    mongoose.connection.on('error', function (err) {
    console.error(`MongoDB connection error: ${err}`);
    process.exit(-1); // eslint-disable-line no-process-exit 
   });
  </code></pre>
  
  <p>does anyone have solution of this ,
  thanx in advance.</p>