@@ -234,6 +234,7 @@ func (coll *Collection) BulkWrite(ctx context.Context, models []WriteModel,
234
234
selector : selector ,
235
235
writeConcern : wc ,
236
236
let : bwo .Let ,
237
+ bypassEmptyTsReplacement : bwo .BypassEmptyTsReplacement ,
237
238
}
238
239
239
240
err = op .execute (ctx )
@@ -307,6 +308,9 @@ func (coll *Collection) insert(ctx context.Context, documents []interface{},
307
308
if imo .Ordered != nil {
308
309
op = op .Ordered (* imo .Ordered )
309
310
}
311
+ if imo .BypassEmptyTsReplacement != nil {
312
+ op = op .BypassEmptyTsReplacement (* imo .BypassEmptyTsReplacement )
313
+ }
310
314
retry := driver .RetryNone
311
315
if coll .client .retryWrites {
312
316
retry = driver .RetryOncePerCommand
@@ -355,6 +359,9 @@ func (coll *Collection) InsertOne(ctx context.Context, document interface{},
355
359
if ioOpts .Comment != nil {
356
360
imOpts .SetComment (ioOpts .Comment )
357
361
}
362
+ if ioOpts .BypassEmptyTsReplacement != nil {
363
+ imOpts .BypassEmptyTsReplacement = ioOpts .BypassEmptyTsReplacement
364
+ }
358
365
res , err := coll .insert (ctx , []interface {}{document }, imOpts )
359
366
360
367
rr , err := processWriteError (err )
@@ -609,6 +616,9 @@ func (coll *Collection) updateOrReplace(ctx context.Context, filter bsoncore.Doc
609
616
}
610
617
op = op .Comment (comment )
611
618
}
619
+ if uo .BypassEmptyTsReplacement != nil {
620
+ op .BypassEmptyTsReplacement (* uo .BypassEmptyTsReplacement )
621
+ }
612
622
retry := driver .RetryNone
613
623
// retryable writes are only enabled updateOne/replaceOne operations
614
624
if ! multi && coll .client .retryWrites {
@@ -760,6 +770,7 @@ func (coll *Collection) ReplaceOne(ctx context.Context, filter interface{},
760
770
uOpts .Hint = opt .Hint
761
771
uOpts .Let = opt .Let
762
772
uOpts .Comment = opt .Comment
773
+ uOpts .BypassEmptyTsReplacement = opt .BypassEmptyTsReplacement
763
774
updateOptions = append (updateOptions , uOpts )
764
775
}
765
776
@@ -1659,6 +1670,9 @@ func (coll *Collection) FindOneAndReplace(ctx context.Context, filter interface{
1659
1670
}
1660
1671
op = op .Let (let )
1661
1672
}
1673
+ if fo .BypassEmptyTsReplacement != nil {
1674
+ op = op .BypassEmptyTsReplacement (* fo .BypassEmptyTsReplacement )
1675
+ }
1662
1676
1663
1677
return coll .findAndModify (ctx , op )
1664
1678
}
@@ -1765,6 +1779,9 @@ func (coll *Collection) FindOneAndUpdate(ctx context.Context, filter interface{}
1765
1779
}
1766
1780
op = op .Let (let )
1767
1781
}
1782
+ if fo .BypassEmptyTsReplacement != nil {
1783
+ op = op .BypassEmptyTsReplacement (* fo .BypassEmptyTsReplacement )
1784
+ }
1768
1785
1769
1786
return coll .findAndModify (ctx , op )
1770
1787
}
0 commit comments