WMO: fix FindOneAndReplace not using FindOneAndReplace
This commit is contained in:
parent
a2ba283632
commit
170f43d806
@ -73,7 +73,7 @@ func (c *Coll[TData]) ReplaceOne(ctx context.Context, filterQuery bson.M, value
|
||||
}
|
||||
|
||||
func (c *Coll[TData]) FindOneAndReplace(ctx context.Context, filterQuery bson.M, value TData) (TData, error) {
|
||||
mongoRes := c.coll.FindOneAndUpdate(ctx, filterQuery, bson.M{"$set": value}, options.FindOneAndUpdate().SetReturnDocument(options.After))
|
||||
mongoRes := c.coll.FindOneAndReplace(ctx, filterQuery, value, options.FindOneAndReplace().SetReturnDocument(options.After))
|
||||
if err := mongoRes.Err(); err != nil {
|
||||
return *new(TData), exerr.Wrap(err, "mongo-query[find-one-and-update] failed").
|
||||
Str("collection", c.Name()).
|
||||
|
Loading…
Reference in New Issue
Block a user