Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
fix: correctly remove deleted goal from multiple datastreams (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
kad-busses authored Mar 17, 2022
1 parent 887711f commit 39912f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/query/processor/observation-goal.es.listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class ObservationGoalEsListener extends AbstractQueryEsListener {
async processObservationGoalRemoved(event: ObservationGoalRemoved): Promise<void> {
try {
const deviceFilter = { 'datastreams.observationGoalIds': event.observationGoalId };
const deviceUpdate = { $pull: { 'datastreams.$.observationGoalIds': event.observationGoalId } };
const deviceUpdate = { $pull: { 'datastreams.$[].observationGoalIds': event.observationGoalId } };
await this.deviceModel.updateMany(deviceFilter, deviceUpdate);

await this.deleteRelations(event.legalEntityId, TargetVariant.OBSERVATION_GOAL, event.observationGoalId);
Expand Down

0 comments on commit 39912f0

Please sign in to comment.