From ec9b0afa5d6415c9baecfadcd801b1ec3f1e468b Mon Sep 17 00:00:00 2001 From: javasgl <731524380@qq.com> Date: Sun, 11 Jun 2023 15:20:31 +0800 Subject: [PATCH] feat: force set upsert to false when use method ReplaceOne (#294) --- collection.go | 1 + 1 file changed, 1 insertion(+) diff --git a/collection.go b/collection.go index 76053ca..a793fad 100644 --- a/collection.go +++ b/collection.go @@ -304,6 +304,7 @@ func (c *Collection) ReplaceOne(ctx context.Context, filter interface{}, doc int if len(opts) > 0 { if opts[0].ReplaceOptions != nil { replaceOpts = opts[0].ReplaceOptions + replaceOpts.SetUpsert(false) } if opts[0].UpdateHook != nil { h = opts[0].UpdateHook