func (c *WebHookColl) Update(owner, repo, address, hookID string) error {
	query := bson.M{"owner": owner, "repo": repo, "address": address}
	change := bson.M{"$set": bson.M{
		"hook_id": hookID,
	}}
	_, err := c.UpdateOne(context.TODO(), query, change)
	return err
}
Update update hookID
package mongodb
import (
	"context"
	"go.mongodb.org/mongo-driver/bson"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
	"github.com/koderover/zadig/pkg/microservice/aslan/config"
	"github.com/koderover/zadig/pkg/microservice/aslan/core/common/repository/models"
	mongotool "github.com/koderover/zadig/pkg/tool/mongo"
)
type WebHookColl struct {
	*mongo.Collection
	coll string
}
func NewWebHookColl() *WebHookColl {
	name := models.WebHook{}.TableName()
	return &WebHookColl{Collection: mongotool.Database(config.MongoDatabase()).Collection(name), coll: name}
}
func (c *WebHookColl) GetCollectionName() string {
	return c.coll
}
func (c *WebHookColl) EnsureIndex(ctx context.Context) error {
	mod := mongo.IndexModel{
		Keys: bson.D{
			bson.E{Key: "owner", Value: 1},
			bson.E{Key: "repo", Value: 1},
			bson.E{Key: "address", Value: 1},
		},
		Options: options.Index().SetUnique(true),
	}
	_, err := c.Indexes().CreateOne(ctx, mod)
	return err
}
func (c *WebHookColl) AddReferenceOrCreate(owner, repo, address, ref string) (bool, error) {
	query := bson.M{"owner": owner, "repo": repo, "address": address}
	change := bson.M{
		"$set": bson.M{
			"owner":   owner,
			"repo":    repo,
			"address": address,
		},
		"$addToSet": bson.M{
			"references": ref,
		}}
	opts := options.FindOneAndUpdate().SetUpsert(true)
	err := c.FindOneAndUpdate(context.TODO(), query, change, opts).Err()
	if err != nil {
		if err == mongo.ErrNoDocuments {
			return true, nil
		}
		return false, err
	}
	return false, nil
}
func (c *WebHookColl) RemoveReference(owner, repo, address, ref string) (*models.WebHook, error) {
	query := bson.M{"owner": owner, "repo": repo, "address": address}
	change := bson.M{
		"$pull": bson.M{
			"references": ref,
		}}
	updated := &models.WebHook{}
	err := c.FindOneAndUpdate(context.TODO(), query, change, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(updated)
	if err != nil && err != mongo.ErrNoDocuments {
		return updated, err
	}
	return updated, nil
}
func (c *WebHookColl) Delete(owner, repo, address string) error {
	query := bson.M{"owner": owner, "repo": repo, "address": address}
	_, err := c.DeleteOne(context.TODO(), query)
	if err != nil && err != mongo.ErrNoDocuments {
		return err
	}
	return nil
}
func (c *WebHookColl) Find(owner, repo, address string) (*models.WebHook, error) {
	query := bson.M{"owner": owner, "repo": repo, "address": address}
	webhook := new(models.WebHook)
	err := c.FindOne(context.TODO(), query).Decode(webhook)
	return webhook, err
}