Skip to content

Commit 4173f7c

Browse files
Merge pull request #19 from chenmingyong0423/feature/updater
updater: fix Upsert method
2 parents 86e6a33 + 36962e9 commit 4173f7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

updater/updater.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (u *Updater[T]) UpdateMany(ctx context.Context, opts ...*options.UpdateOpti
146146

147147
func (u *Updater[T]) Upsert(ctx context.Context, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error) {
148148
if len(opts) == 0 {
149-
options.Replace().SetUpsert(true)
149+
opts = append(opts, options.Replace().SetUpsert(true))
150150
} else {
151151
opts[0].SetUpsert(true)
152152
}

0 commit comments

Comments
 (0)