@@ -117,6 +117,7 @@ pub struct InsertOneOptions {
117
117
pub bypass_document_validation : Option < bool > ,
118
118
119
119
/// The write concern for the operation.
120
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
120
121
pub write_concern : Option < WriteConcern > ,
121
122
122
123
/// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the
@@ -295,6 +296,7 @@ pub struct ReplaceOptions {
295
296
pub hint : Option < Hint > ,
296
297
297
298
/// The write concern for the operation.
299
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
298
300
pub write_concern : Option < WriteConcern > ,
299
301
300
302
/// Map of parameter names and values. Values must be constant or closed
@@ -335,6 +337,7 @@ pub struct DeleteOptions {
335
337
pub collation : Option < Collation > ,
336
338
337
339
/// The write concern for the operation.
340
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
338
341
pub write_concern : Option < WriteConcern > ,
339
342
340
343
/// The index to use for the operation.
@@ -379,6 +382,7 @@ pub struct FindOneAndDeleteOptions {
379
382
pub sort : Option < Document > ,
380
383
381
384
/// The level of the write concern
385
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
382
386
pub write_concern : Option < WriteConcern > ,
383
387
384
388
/// The collation to use for the operation.
@@ -438,6 +442,7 @@ pub struct FindOneAndReplaceOptions {
438
442
pub upsert : Option < bool > ,
439
443
440
444
/// The level of the write concern
445
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
441
446
pub write_concern : Option < WriteConcern > ,
442
447
443
448
/// The collation to use for the operation.
@@ -503,6 +508,7 @@ pub struct FindOneAndUpdateOptions {
503
508
pub upsert : Option < bool > ,
504
509
505
510
/// The level of the write concern
511
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
506
512
pub write_concern : Option < WriteConcern > ,
507
513
508
514
/// The collation to use for the operation.
@@ -615,6 +621,7 @@ pub struct AggregateOptions {
615
621
///
616
622
/// If none is specified, the write concern defined on the object executing this operation will
617
623
/// be used.
624
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
618
625
pub write_concern : Option < WriteConcern > ,
619
626
620
627
/// A document with any amount of parameter names, each followed by definitions of constants in
@@ -1056,6 +1063,7 @@ pub struct CreateIndexOptions {
1056
1063
pub max_time : Option < Duration > ,
1057
1064
1058
1065
/// The write concern for the operation.
1066
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
1059
1067
pub write_concern : Option < WriteConcern > ,
1060
1068
1061
1069
/// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the
@@ -1075,6 +1083,7 @@ pub struct CreateIndexOptions {
1075
1083
#[ export_tokens]
1076
1084
pub struct DropCollectionOptions {
1077
1085
/// The write concern for the operation.
1086
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
1078
1087
pub write_concern : Option < WriteConcern > ,
1079
1088
1080
1089
/// Map of encrypted fields for the collection.
@@ -1108,6 +1117,7 @@ pub struct DropIndexOptions {
1108
1117
pub max_time : Option < Duration > ,
1109
1118
1110
1119
/// The write concern for the operation.
1120
+ #[ serde( skip_serializing_if = "write_concern_is_empty" ) ]
1111
1121
pub write_concern : Option < WriteConcern > ,
1112
1122
1113
1123
/// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the
0 commit comments