As per discussion https://github.com/agenda/agenda/pull/476#pullrequestreview-51278158
@joeframbach says:
Going forward in mongodb, ensureIndex is deprecated in favor of createIndex. Is this an appropriate time to also make this change?
@loris also suggested:
Agree to keep it focused. IMO, the
ensureIndex/createIndexshould be removed in favor of a simple instruction in the setup inREADME.md
https://docs.mongodb.com/manual/reference/method/db.collection.ensureIndex/
https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#db.collection.createIndex
Breaks compatibility with MongoDB 2.x I assume, so this can also wait for 2.x — thoughts?
I've meant for a long time to study if doing createIndex() in code on initialisation is okay for production or should it always be done separately...
Agenda database can easily be quite massive so this should at least be configurable.
I agree to be optional but I'd like to have it "automatic", so I'd add the option { index: true } on the Agenda initialisation function to run the createIndex, putting { index: false } by default and changing the README.md to explain this.
I'd go for the opposite, unless you need to create your own indexes you're better off starting with our provided ones. I'd go for {index: true} as default and have {index: false} as an option.
This also allows backwards compatibility since all current installs create the indexes by default.
Closing this, follow ups to #497 (_Drop MongoDB 2.x support_) and #498 (_Make createIndex configurable_)
Actually not closing, this is still relevant. :-)
Most helpful comment
I'd go for the opposite, unless you need to create your own indexes you're better off starting with our provided ones. I'd go for
{index: true}as default and have{index: false}as an option.This also allows backwards compatibility since all current installs create the indexes by default.