Indexing in mongoid: when and how often should I run rake db: mongoid: create_indexes?

This is not entirely clear from the documentation: when and how often should I run rake db:mongoid:create_indexes . Let me say that I have added some index macros to models already and I will never add new ones in the future. Does this mean that I can run the rake task only once or should I run it, say, once a day?

+6
source share
1 answer

You must run the task once.

After the indexes have been created, you no longer need to run the command, since the indexes already exist and do not need to be added again.

Of course, if you create new indexes, you will need to run a command to add new indexes to mongodb.

+8
source

Source: https://habr.com/ru/post/892172/


All Articles