To add or change index options other than collation, you must drop the index using the dropIndex() method and issue another db.collection.createIndex() operation with the new options.
Currently, Model::sync only diffs the keys of the index itself, but does not take into account the possibility that the options of the index may have changed. It definitely should take this into account and drop an index first if needed.
The code resides in wither::model::sync_model_indexes. A private function of the module which is called from Model::sync.
According to the MongoDB docs:
Currently,
Model::sync
only diffs the keys of the index itself, but does not take into account the possibility that the options of the index may have changed. It definitely should take this into account and drop an index first if needed.The code resides in
wither::model::sync_model_indexes
. A private function of the module which is called fromModel::sync
.