Solution :
The issue is that the mongoose still uses the collection.ensureIndex and must be updated by them in the near future. So to get rid of your error message you can downgrade it by using version 5.2.8 in your package.json and also delete any caches, last resort is to uninstall it the install it with npm install mongoose@5.2.8:
"mongoose": "^5.2.8"
Per mongoose docs please follow below steps:
mongoose.set('useNewUrlParser', true);
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);
Replace update() with updateOne(), updateMany(), or replaceOne()
Replace remove() with deleteOne() or deleteMany().
Replace count() with countDocuments(), Here unless you want to count how many documents are in the whole collection (no filter). In the latter case, please use estimatedDocumentCount().