From fdde1764e9e20eb11ab9d8af0c4221bd475f986c Mon Sep 17 00:00:00 2001 From: Preston Vasquez Date: Tue, 5 Dec 2023 11:38:19 -0700 Subject: [PATCH] GODRIVER-2937 Copy BSONOptions when merging coll or db opts (#1483) --- mongo/options/collectionoptions.go | 3 +++ mongo/options/dboptions.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/mongo/options/collectionoptions.go b/mongo/options/collectionoptions.go index 04fda6d779..7904dbd672 100644 --- a/mongo/options/collectionoptions.go +++ b/mongo/options/collectionoptions.go @@ -95,6 +95,9 @@ func MergeCollectionOptions(opts ...*CollectionOptions) *CollectionOptions { if opt.Registry != nil { c.Registry = opt.Registry } + if opt.BSONOptions != nil { + c.BSONOptions = opt.BSONOptions + } } return c diff --git a/mongo/options/dboptions.go b/mongo/options/dboptions.go index 8a380d2168..38ee13550b 100644 --- a/mongo/options/dboptions.go +++ b/mongo/options/dboptions.go @@ -95,6 +95,9 @@ func MergeDatabaseOptions(opts ...*DatabaseOptions) *DatabaseOptions { if opt.Registry != nil { d.Registry = opt.Registry } + if opt.BSONOptions != nil { + d.BSONOptions = opt.BSONOptions + } } return d