The answer to Shaver is very good, but it doesn't really address the issue that gravetii is highlighting.
createIndex will fail with this error if you try to create an index in the same fields with the same order but with different parameters. This is due to the fact that index parameters can lead to the fact that the index has very different properties. This is obvious if you are considering an index with a unique flag.
If you call createIndex with the same fields, the same order and the same parameters, it will behave as you expect; without changing the collection indexes, and will not throw an exception.
source share