Skip to content

Commit

Permalink
UpdateIAmAlive for SingleMembership fixed to not create invalid subdo…
Browse files Browse the repository at this point in the history
…cuments without required properties
  • Loading branch information
lehoncak-intens authored and wassim-k committed Mar 12, 2024
1 parent cd9d50c commit ec538dd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ public async Task<MembershipTableData> ReadRow(string deploymentId, SiloAddress

public async Task UpdateIAmAlive(string deploymentId, SiloAddress address, DateTime iAmAliveTime)
{
await Collection.UpdateOneAsync(x => x.DeploymentId == deploymentId,
Update
var filter = Builders<DeploymentDocument>.Filter.And(
Builders<DeploymentDocument>.Filter.Eq(x => x.DeploymentId, deploymentId),
Builders<DeploymentDocument>.Filter.Exists($"Members.{BuildKey(address)}", true));

await Collection.UpdateOneAsync(filter, Update
.Set($"Members.{BuildKey(address)}.IAmAliveTime", LogFormatter.PrintDate(iAmAliveTime)));
}

Expand Down

0 comments on commit ec538dd

Please sign in to comment.