@@ -815,6 +815,7 @@ where
815
815
session : impl Into < Option < & mut ClientSession > > ,
816
816
) -> Result < UpdateResult > {
817
817
let replacement = to_document ( & replacement) ?;
818
+
818
819
bson_util:: replacement_document_check ( & replacement) ?;
819
820
820
821
let mut options = options. into ( ) ;
@@ -872,11 +873,12 @@ where
872
873
session : impl Into < Option < & mut ClientSession > > ,
873
874
) -> Result < UpdateResult > {
874
875
let update = update. into ( ) ;
876
+
875
877
let mut options = options. into ( ) ;
876
878
877
879
if let UpdateModifications :: Document ( ref d) = update {
878
880
bson_util:: update_document_check ( d) ?;
879
- } ;
881
+ }
880
882
881
883
resolve_options ! ( self , options, [ write_concern] ) ;
882
884
@@ -924,9 +926,15 @@ where
924
926
session : impl Into < Option < & mut ClientSession > > ,
925
927
) -> Result < UpdateResult > {
926
928
let mut options = options. into ( ) ;
929
+ let update = update. into ( ) ;
930
+
931
+ if let UpdateModifications :: Document ( ref d) = update {
932
+ bson_util:: update_document_check ( d) ?;
933
+ }
934
+
927
935
resolve_options ! ( self , options, [ write_concern] ) ;
928
936
929
- let update = Update :: new ( self . namespace ( ) , query, update. into ( ) , false , options) ;
937
+ let update = Update :: new ( self . namespace ( ) , query, update, false , options) ;
930
938
self . client ( ) . execute_operation ( update, session) . await
931
939
}
932
940
0 commit comments