Skip to content

Commit 662248b

Browse files
authored
Force non-human readable serialization in collections (mongodb#919)
1 parent c33d83a commit 662248b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/coll/mod.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use serde::{
1515

1616
use self::options::*;
1717
use crate::{
18-
bson::{doc, to_document, Bson, Document},
18+
bson::{doc, to_document_with_options, Bson, Document, SerializerOptions},
1919
bson_util,
2020
change_stream::{
2121
event::ChangeStreamEvent,
@@ -1119,7 +1119,10 @@ where
11191119
options: impl Into<Option<FindOneAndReplaceOptions>>,
11201120
session: impl Into<Option<&mut ClientSession>>,
11211121
) -> Result<Option<T>> {
1122-
let replacement = to_document(replacement.borrow())?;
1122+
let replacement = to_document_with_options(
1123+
replacement.borrow(),
1124+
SerializerOptions::builder().human_readable(false).build(),
1125+
)?;
11231126

11241127
let session = session.into();
11251128

@@ -1379,7 +1382,10 @@ where
13791382
options: impl Into<Option<ReplaceOptions>>,
13801383
session: impl Into<Option<&mut ClientSession>>,
13811384
) -> Result<UpdateResult> {
1382-
let replacement = to_document(replacement.borrow())?;
1385+
let replacement = to_document_with_options(
1386+
replacement.borrow(),
1387+
SerializerOptions::builder().human_readable(false).build(),
1388+
)?;
13831389

13841390
bson_util::replacement_document_check(&replacement)?;
13851391

0 commit comments

Comments
 (0)