Skip to content

Commit

Permalink
Force non-human readable serialization in collections (#919) (#924)
Browse files Browse the repository at this point in the history
Co-authored-by: Konstantinos Demartinos <konstantinos.demartinos@iota.org>
  • Loading branch information
isabelatkinson and kodemartin authored Aug 2, 2023
1 parent 219b934 commit 76cf349
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/coll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use serde::{

use self::options::*;
use crate::{
bson::{doc, to_document, Bson, Document},
bson::{doc, to_document_with_options, Bson, Document, SerializerOptions},
bson_util,
change_stream::{
event::ChangeStreamEvent,
Expand Down Expand Up @@ -1119,7 +1119,10 @@ where
options: impl Into<Option<FindOneAndReplaceOptions>>,
session: impl Into<Option<&mut ClientSession>>,
) -> Result<Option<T>> {
let replacement = to_document(replacement.borrow())?;
let replacement = to_document_with_options(
replacement.borrow(),
SerializerOptions::builder().human_readable(false).build(),
)?;

let session = session.into();

Expand Down Expand Up @@ -1379,7 +1382,10 @@ where
options: impl Into<Option<ReplaceOptions>>,
session: impl Into<Option<&mut ClientSession>>,
) -> Result<UpdateResult> {
let replacement = to_document(replacement.borrow())?;
let replacement = to_document_with_options(
replacement.borrow(),
SerializerOptions::builder().human_readable(false).build(),
)?;

bson_util::replacement_document_check(&replacement)?;

Expand Down

0 comments on commit 76cf349

Please sign in to comment.