@@ -117,6 +117,7 @@ pub struct InsertOneOptions {
117117 pub bypass_document_validation : Option < bool > ,
118118
119119 /// The write concern for the operation.
120+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
120121 pub write_concern : Option < WriteConcern > ,
121122
122123 /// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the
@@ -295,6 +296,7 @@ pub struct ReplaceOptions {
295296 pub hint : Option < Hint > ,
296297
297298 /// The write concern for the operation.
299+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
298300 pub write_concern : Option < WriteConcern > ,
299301
300302 /// Map of parameter names and values. Values must be constant or closed
@@ -335,6 +337,7 @@ pub struct DeleteOptions {
335337 pub collation : Option < Collation > ,
336338
337339 /// The write concern for the operation.
340+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
338341 pub write_concern : Option < WriteConcern > ,
339342
340343 /// The index to use for the operation.
@@ -379,6 +382,7 @@ pub struct FindOneAndDeleteOptions {
379382 pub sort : Option < Document > ,
380383
381384 /// The level of the write concern
385+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
382386 pub write_concern : Option < WriteConcern > ,
383387
384388 /// The collation to use for the operation.
@@ -438,6 +442,7 @@ pub struct FindOneAndReplaceOptions {
438442 pub upsert : Option < bool > ,
439443
440444 /// The level of the write concern
445+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
441446 pub write_concern : Option < WriteConcern > ,
442447
443448 /// The collation to use for the operation.
@@ -503,6 +508,7 @@ pub struct FindOneAndUpdateOptions {
503508 pub upsert : Option < bool > ,
504509
505510 /// The level of the write concern
511+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
506512 pub write_concern : Option < WriteConcern > ,
507513
508514 /// The collation to use for the operation.
@@ -615,6 +621,7 @@ pub struct AggregateOptions {
615621 ///
616622 /// If none is specified, the write concern defined on the object executing this operation will
617623 /// be used.
624+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
618625 pub write_concern : Option < WriteConcern > ,
619626
620627 /// A document with any amount of parameter names, each followed by definitions of constants in
@@ -1056,6 +1063,7 @@ pub struct CreateIndexOptions {
10561063 pub max_time : Option < Duration > ,
10571064
10581065 /// The write concern for the operation.
1066+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
10591067 pub write_concern : Option < WriteConcern > ,
10601068
10611069 /// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the
@@ -1075,6 +1083,7 @@ pub struct CreateIndexOptions {
10751083#[ export_tokens]
10761084pub struct DropCollectionOptions {
10771085 /// The write concern for the operation.
1086+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
10781087 pub write_concern : Option < WriteConcern > ,
10791088
10801089 /// Map of encrypted fields for the collection.
@@ -1108,6 +1117,7 @@ pub struct DropIndexOptions {
11081117 pub max_time : Option < Duration > ,
11091118
11101119 /// The write concern for the operation.
1120+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
11111121 pub write_concern : Option < WriteConcern > ,
11121122
11131123 /// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the
0 commit comments