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.
source share