Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/coll/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub mod options;

use std::{borrow::Borrow, collections::HashSet, fmt, fmt::Debug, sync::Arc};

use bson::{to_document_with_options, SerializerOptions};
use futures_util::{
future,
stream::{StreamExt, TryStreamExt},
Expand All @@ -15,7 +16,7 @@ use serde::{

use self::options::*;
use crate::{
bson::{doc, to_document, Bson, Document},
bson::{doc, Bson, Document},
bson_util,
change_stream::{
event::ChangeStreamEvent,
Expand Down Expand Up @@ -1119,7 +1120,12 @@ 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(Some(false))
.build(),
)?;

let session = session.into();

Expand Down Expand Up @@ -1379,7 +1385,12 @@ 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(Some(false))
.build(),
)?;

bson_util::replacement_document_check(&replacement)?;

Expand Down