Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

It's not quite clear from the documentation: when and how often should I run rake db:mongoid:create_indexes. Let's say I added some indexes macro to the models already and am never going to add new ones in the future. Does that mean I may run the rake task just once or should I be running it, say, once a day?

like image 260
snitko Avatar asked Jul 06 '11 21:07

snitko


1 Answers

You should run the task once.

After the indexes have been created, you don't need to run the command anymore as the indexes already exist and don't need to be added again.

Of course, if you create new indexes, you'll need to run the command to add the new indexes to mongodb.

like image 129
Andz Avatar answered Sep 19 '22 12:09

Andz