This commit is contained in:
Nicolas CARON 2023-02-01 10:09:43 +01:00
parent 5feb1b720e
commit ffa341b13d
1 changed files with 10 additions and 0 deletions

View File

@ -120,3 +120,13 @@ func (s MongoDBStorage) AddSubscription(eventid string, subscription Subscriptio
_, err := collection.UpdateOne(context.TODO(), filter, push)
return err
}
func (s MongoDBStorage) RemoveSubscription(subscriptionid string, subscription Subscription) error {
collection := s.Client.Database(s.DbName).Collection(s.Collections["events"])
filter := bson.M{"_id": subscriptionid}
push := bson.M{"$pull": bson.M{"subscriptions": subscription}}
_, err := collection.UpdateOne(context.TODO(), filter, push)
return err
}