@@ -234,6 +234,7 @@ func (coll *Collection) BulkWrite(ctx context.Context, models []WriteModel,
234234 selector : selector ,
235235 writeConcern : wc ,
236236 let : bwo .Let ,
237+ bypassEmptyTsReplacement : bwo .BypassEmptyTsReplacement ,
237238 }
238239
239240 err = op .execute (ctx )
@@ -307,6 +308,9 @@ func (coll *Collection) insert(ctx context.Context, documents []interface{},
307308 if imo .Ordered != nil {
308309 op = op .Ordered (* imo .Ordered )
309310 }
311+ if imo .BypassEmptyTsReplacement != nil {
312+ op = op .BypassEmptyTsReplacement (* imo .BypassEmptyTsReplacement )
313+ }
310314 retry := driver .RetryNone
311315 if coll .client .retryWrites {
312316 retry = driver .RetryOncePerCommand
@@ -355,6 +359,9 @@ func (coll *Collection) InsertOne(ctx context.Context, document interface{},
355359 if ioOpts .Comment != nil {
356360 imOpts .SetComment (ioOpts .Comment )
357361 }
362+ if ioOpts .BypassEmptyTsReplacement != nil {
363+ imOpts .BypassEmptyTsReplacement = ioOpts .BypassEmptyTsReplacement
364+ }
358365 res , err := coll .insert (ctx , []interface {}{document }, imOpts )
359366
360367 rr , err := processWriteError (err )
@@ -609,6 +616,9 @@ func (coll *Collection) updateOrReplace(ctx context.Context, filter bsoncore.Doc
609616 }
610617 op = op .Comment (comment )
611618 }
619+ if uo .BypassEmptyTsReplacement != nil {
620+ op .BypassEmptyTsReplacement (* uo .BypassEmptyTsReplacement )
621+ }
612622 retry := driver .RetryNone
613623 // retryable writes are only enabled updateOne/replaceOne operations
614624 if ! multi && coll .client .retryWrites {
@@ -760,6 +770,7 @@ func (coll *Collection) ReplaceOne(ctx context.Context, filter interface{},
760770 uOpts .Hint = opt .Hint
761771 uOpts .Let = opt .Let
762772 uOpts .Comment = opt .Comment
773+ uOpts .BypassEmptyTsReplacement = opt .BypassEmptyTsReplacement
763774 updateOptions = append (updateOptions , uOpts )
764775 }
765776
@@ -1659,6 +1670,9 @@ func (coll *Collection) FindOneAndReplace(ctx context.Context, filter interface{
16591670 }
16601671 op = op .Let (let )
16611672 }
1673+ if fo .BypassEmptyTsReplacement != nil {
1674+ op = op .BypassEmptyTsReplacement (* fo .BypassEmptyTsReplacement )
1675+ }
16621676
16631677 return coll .findAndModify (ctx , op )
16641678}
@@ -1765,6 +1779,9 @@ func (coll *Collection) FindOneAndUpdate(ctx context.Context, filter interface{}
17651779 }
17661780 op = op .Let (let )
17671781 }
1782+ if fo .BypassEmptyTsReplacement != nil {
1783+ op = op .BypassEmptyTsReplacement (* fo .BypassEmptyTsReplacement )
1784+ }
17681785
17691786 return coll .findAndModify (ctx , op )
17701787}
0 commit comments