The error is because of the new version of the mongoose i.e version 6.0.6.
useNewUrlParser
, useUnifiedTopology
, useFindAndModify
, and useCreateIndex
are no longer supported options. Mongoose 6 always behaves as if useNewUrlParser
, useUnifiedTopology
, and useCreateIndex
are true
, and useFindAndModify
is false
. Please remove these options from your code.
// No longer necessary: mongoose.set('useFindAndModify', false); await mongoose.connect('mongodb://localhost:27017/test', { useNewUrlParser: true, // <-- no longer necessary useUnifiedTopology: true // <-- no longer necessary });