question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

See original GitHub issue

After update to version 5.2.9 I’m getting this message in console all the time, when I start my web app:

DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

And I don’t use neither of them.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:32 (1 by maintainers)

github_iconTop GitHub Comments

168reactions
samuelceciliocommented, Aug 28, 2018

After upgrading to version 5.2.10. Any of the options below should stop the warnings?

mongoose.connect(config.dbUri, {
  useCreateIndex: true,
  useNewUrlParser: true
})

or

mongoose.set('useCreateIndex', true)
mongoose.connect(config.dbUri, { useNewUrlParser: true })

It didnt work here. (Sorry if I did something wrong)

108reactions
vkarpov15commented, Aug 27, 2018

@nonniv upgrade to 5.2.10 and set mongoose.set('useCreateIndex', true);

Read more comments on GitHub >

github_iconTop Results From Across the Web

(node:63208) DeprecationWarning: collection.ensureIndex is ...
I am not using ensureIndex or createIndex in my Nodejs application anywhere. I am using yarn package manager. Here is my code in...
Read more >
collection.ensureIndex is deprecated. Use createIndexes ...
NodeJS: mongoose Deprecation Warning: collection.ensureIndex is deprecated. Use createIndexes instead ... (node:73172) DeprecationWarning: collection.
Read more >
collection.ensureindex is deprecated. use createindexes ...
deprecationwarning : collection.ensureindex is deprecated. use createindexes instead. · Oops, You will need to install Grepper and log-in to perform this action.
Read more >
(node:63208) DeprecationWarning: collection.ensureIndex is ...
Node.js – (node:63208) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. mongodbmongoosenode.js.
Read more >
Authentication and Authorization - 3 - Code with Mosh Forum
“(node:11412) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. (Use node --trace-deprecation ... to show ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found