Open
Description
Bug Report
Running the doctrine:mongodb:schema:update
command fails with error Index with name: <index_name> already exists with a different name
if there already exists an index with same keys and options but different name on the collection.
Q | A |
---|---|
BC Break | yes |
Version | 2.1.2 |
Summary
Because name of an index is ignored when checking if index should be dropped in SchemaManager (PR #2114) and because mongodb
prevets creating duplicate indexes with different names, running schema update after renaming index can lead to failure.
Current behavior
Schema update fails with Index with name: <index_name> already exists with a different name
.
How to reproduce
- Create entity mapping with an index
- run
doctrine:mongodb:schema:update
- rename the index in the mapping
- run
doctrine:mongodb:schema:update
Expected behavior
Drop the existing index, create a new one with the correct name.