Answers for "(node:21880) DeprecationWarning: collection.ensureIndex is deprecated."

11

collection.ensureIndex is deprecated

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

(node:2736) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

mongoose.connect(
  url,
  {useCreateIndex: true },
  () => {
    console.log("MongoDB is connected!");
  }
);
Posted by: Guest on February-24-2021

Code answers related to "(node:21880) DeprecationWarning: collection.ensureIndex is deprecated."

Code answers related to "Javascript"

Browse Popular Code Answers by Language