Skip to content

Commit

Permalink
Simplify unique constraint for documents
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Dec 11, 2024
1 parent c9a86db commit 6c83108
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions server/backend/database/mongo/indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,9 @@ var collectionInfos = []collectionInfo{
Keys: bsonx.Doc{
{Key: "project_id", Value: bsonx.Int32(1)}, // shard key
{Key: "key", Value: bsonx.Int32(1)},
{Key: "removed_at", Value: bsonx.Int32(1)},
},
Options: options.Index().SetPartialFilterExpression(
bsonx.Doc{
{Key: "removed_at", Value: bsonx.Null()},
},
).SetUnique(true),
Options: options.Index().SetUnique(true),
}},
}, {
name: ColChanges,
Expand Down

0 comments on commit 6c83108

Please sign in to comment.