This commit is contained in:
Mike Schwörer 2023-06-08 16:17:01 +02:00
parent 6589e8d5cd
commit dc2d8a9103
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.151"
const GoextVersion = "0.0.152"
const GoextVersionTimestamp = "2023-06-07T17:57:03+0200"
const GoextVersionTimestamp = "2023-06-08T16:17:01+0200"

View File

@ -46,7 +46,7 @@ func (c *Coll[TData]) UpdateMany(ctx context.Context, filterQuery bson.M, update
}
func (c *Coll[TData]) ReplaceOne(ctx context.Context, id EntityID, value TData) error {
_, err := c.coll.UpdateOne(ctx, bson.M{"_id": id}, value)
_, err := c.coll.UpdateOne(ctx, bson.M{"_id": id}, bson.M{"$set": value})
if err != nil {
return err
}
@ -57,7 +57,7 @@ func (c *Coll[TData]) ReplaceOne(ctx context.Context, id EntityID, value TData)
func (c *Coll[TData]) FindOneAndReplace(ctx context.Context, id EntityID, value TData) (TData, error) {
var res TData
err := c.coll.FindOneAndUpdate(ctx, bson.M{"_id": id}, value, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&res)
err := c.coll.FindOneAndUpdate(ctx, bson.M{"_id": id}, bson.M{"$set": value}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&res)
if err != nil {
return *new(TData), err
}