Skip to content

Commit db97329

Browse files
RUST-759 Skip deserializing None for DropCollectionOptions (#327)
1 parent 6666a46 commit db97329

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/coll/options.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ pub struct FindOneOptions {
814814

815815
/// Specifies the options to a [`Collection::drop`](../struct.Collection.html#method.drop)
816816
/// operation.
817+
#[serde_with::skip_serializing_none]
817818
#[derive(Debug, Default, TypedBuilder, Serialize)]
818819
#[serde(rename_all = "camelCase")]
819820
#[builder(field_defaults(default, setter(strip_option)))]

src/test/coll.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::{
1414
AggregateOptions,
1515
CollectionOptions,
1616
DeleteOptions,
17+
DropCollectionOptions,
1718
FindOneAndDeleteOptions,
1819
FindOneOptions,
1920
FindOptions,
@@ -1007,3 +1008,15 @@ async fn assert_options_inherited(client: &EventClient, command_name: &str) {
10071008
!client.is_standalone()
10081009
);
10091010
}
1011+
1012+
#[cfg_attr(feature = "tokio-runtime", tokio::test)]
1013+
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
1014+
#[function_name::named]
1015+
async fn drop_skip_serializing_none() {
1016+
let client = TestClient::new().await;
1017+
let coll: Collection<Document> = client
1018+
.database(function_name!())
1019+
.collection(function_name!());
1020+
let options = DropCollectionOptions::builder().build();
1021+
assert!(coll.drop(options).await.is_ok());
1022+
}

0 commit comments

Comments
 (0)