Skip to content

Update indexes fails if there already exists same index with different name. #2224

Open
@endrsmar

Description

@endrsmar

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions