Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collection.ensureIndex is deprecated. Use createIndexes instead. #26

Open
Bauke opened this issue Apr 3, 2019 · 18 comments
Open

collection.ensureIndex is deprecated. Use createIndexes instead. #26

Bauke opened this issue Apr 3, 2019 · 18 comments

Comments

@Bauke
Copy link

Bauke commented Apr 3, 2019

When using mongoose-plugin-autoinc this warning pops up, didn't find another issue for it so thought I'd make one.

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

@lstandifer
Copy link

Automattic/mongoose#6890

@alailsonribeiro
Copy link

const mongoose = require('mongoose'); mongoose.set('useCreateIndex', true);

@ghost
Copy link

ghost commented Aug 30, 2019

const mongoose = require('mongoose'); mongoose.set('useCreateIndex', true);

Thanks bro! <3

@bernardpiccoli
Copy link

Thank

@rayremedi
Copy link

Thx man!

@spensbot
Copy link

spensbot commented Jan 9, 2020

You sir, are a gentleman, and a scholar

@Vaz-Tiago
Copy link

const mongoose = require('mongoose'); mongoose.set('useCreateIndex', true);

Tanks

@otiagoluz
Copy link

const mongoose = require('mongoose'); mongoose.set('useCreateIndex', true);

WOW!
Thanks!

@6xAs
Copy link

6xAs commented Jan 15, 2020

Thanks!!! for Helping me

@webfaria
Copy link

Thanks flw

@jakzeve
Copy link

jakzeve commented Jan 29, 2020

Thank you! alailsonribeiro

@APIDevSandy
Copy link

const mongoose = require('mongoose');
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);

This works for me.

Thanks,
Sandeep

@AntonioDev-GolStats
Copy link

this works for me, thank you

@BrenoGO
Copy link

BrenoGO commented Feb 13, 2020

if you're using mongoose.connect, I am using like below, and receiving no warning:

mongoose.connect(process.env.MONGO_URI, {
  useNewUrlParser: true,
  useUnifiedTopology: true,
  useCreateIndex: true,
});

@maiconparra
Copy link

Me salvou de muito estresse alailsonribeiro muito obrigado.

@milansukhadiya
Copy link

When using mongoose-plugin-autoinc this warning pops up, didn't find another issue for it so thought I'd make one.

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

mongoose.connect("mongodb://localhost:27017/userDB",{useNewUrlParser:true,useUnifiedTopology: true,useCreateIndex:true});

@marconydev
Copy link

const mongoose = require('mongoose'); mongoose.set('useCreateIndex', true);

Muito obrigado, deu certo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests