Skip to content

Commit 7c6e278

Browse files
committed
fix AliasQuery logic that failed when the alias already exists
1 parent fa27cdf commit 7c6e278

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/UnidocDB/Packages/Unidoc.AliasQuery.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import UnidocRecords
55
extension Unidoc
66
{
77
/// A query that adds a new alias to the specified `Aliases` collection by looking up and
8-
/// branching from an existing alias.
8+
/// branching from an existing alias. If the alias already exists, the query does nothing.
99
struct AliasQuery<Aliases>:Sendable
1010
where Aliases:Mongo.CollectionModel,
1111
Aliases.Element:MongoMasterCodingModel<Unidoc.AliasKey>
@@ -50,7 +50,7 @@ extension Unidoc.AliasQuery:Mongo.PipelineQuery
5050
$0[.into] = Aliases.name
5151
$0[.on] = Aliases.Element[.id]
5252
$0[.whenNotMatched] = .insert
53-
$0[.whenMatched] = .fail
53+
$0[.whenMatched] = .keepExisting
5454
}
5555
}
5656
}

0 commit comments

Comments
 (0)