jedireza / mongo-models

:package: Map JavaScript classes to MongoDB collections
MIT License
67 stars 28 forks source link

[Question] createIndexes guide #33

Closed anhntbk08 closed 6 years ago

anhntbk08 commented 6 years ago

Hi,

Thank for your great work. I just wonder what is the best way to use createIndexes?

Can it be totally automatic when we defined model?

Cheers.

jedireza commented 6 years ago

Yeah you need to instrument that in your own app. The bigger your app gets the less likely you'd wan't to run an auto indexer when the app started.

hapi-mongo-models actually does have an option that takes advantage of the createIndexes method.