diff --git a/wmo/queryUpdate.go b/wmo/queryUpdate.go index cca8cc9..d3ce0c7 100644 --- a/wmo/queryUpdate.go +++ b/wmo/queryUpdate.go @@ -3,6 +3,7 @@ package wmo import ( "context" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" ) @@ -35,6 +36,15 @@ func (c *Coll[TData]) UpdateOneByID(ctx context.Context, id EntityID, updateQuer return nil } +func (c *Coll[TData]) UpdateMany(ctx context.Context, filterQuery bson.M, updateQuery bson.M) (*mongo.UpdateResult, error) { + res, err := c.coll.UpdateMany(ctx, filterQuery, updateQuery) + if err != nil { + return nil, err + } + + return res, nil +} + func (c *Coll[TData]) ReplaceOne(ctx context.Context, id EntityID, value TData) error { _, err := c.coll.UpdateOne(ctx, bson.M{"_id": id}, value) if err != nil {