Answers for "DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. 2021"

11

collection.ensureIndex is deprecated

mongoose.connect(dbURI, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useCreateIndex: true,
    useFindAndModify: true,
})
Posted by: Guest on December-01-2020
1

(node:14800) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. (Use `node --trace-deprecation ...` to show where the warning was created)

mongoose
  .connect(process.env.DB_CONNECTION, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    dbName: "business",
    useCreateIndex: true
  })
Posted by: Guest on February-26-2021

Code answers related to "DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. 2021"

Code answers related to "Javascript"

Browse Popular Code Answers by Language