Answers for "(node:45536) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead."

11

collection.ensureIndex is deprecated

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

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

mongoose.set('useNewUrlParser', true);
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);
Posted by: Guest on July-06-2020

Code answers related to "(node:45536) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead."

Code answers related to "Javascript"

Browse Popular Code Answers by Language