Skip to content
Merged
2 changes: 1 addition & 1 deletion chaoscenter/graphql/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ USER 65534

CMD ["./server"]

EXPOSE 8080
EXPOSE 8080
12 changes: 5 additions & 7 deletions chaoscenter/graphql/server/pkg/database/mongodb/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,14 @@ func (m *MongoClient) initAllCollection() {

m.ChaosProbeCollection = m.Database.Collection(Collections[ChaosProbeCollection])
_, err = m.ChaosProbeCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{
{
Keys: bson.M{
"name": 1,
},
Options: options.Index().SetUnique(true),
},
{
Keys: bson.D{
{"project_id", 1},
{Key: "name", Value: 1},
{Key: "project_id", Value: 1},
},
Options: options.Index().SetUnique(true).SetPartialFilterExpression(bson.D{{
Key: "is_removed", Value: false,
}}),
},
})
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions chaoscenter/graphql/server/pkg/probe/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ func (p *probeService) ValidateUniqueProbe(ctx context.Context, probeName, proje
query := bson.D{
{"name", probeName},
{"project_id", bson.D{{"$eq", projectID}}},
{"is_removed", false},
}

isUnique, err := p.probeOperator.IsProbeUnique(ctx, query)
Expand Down
Loading