From e89e2c18f2c1c7a7884c36b4b814f368291999f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 7 Jun 2023 10:56:11 +0200 Subject: [PATCH] v0.0.141 --- wmo/queryUpdate.go | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 {