Skip to content

Commit

Permalink
fixed/manipmongo: EnsureIdex error check
Browse files Browse the repository at this point in the history
The error message varies if mongo is sharded or not.
  • Loading branch information
primalmotion committed Jul 16, 2019
1 parent 3b099b2 commit c99619b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion manipmongo/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func EnsureIndex(manipulator manipulate.Manipulator, identity elemental.Identity
}
if err := collection.EnsureIndex(index); err != nil {

if strings.HasSuffix(err.Error(), "already exists with different options") {
if strings.Contains(err.Error(), "already exists with different options") {
if err := collection.DropIndexName(index.Name); err != nil {
return fmt.Errorf("cannot delete previous index: %s", err)
}
Expand Down

0 comments on commit c99619b

Please sign in to comment.