@@ -2058,7 +2058,6 @@ _mongoc_collection_update_or_replace (
20582058 BSON_ASSERT (collection );
20592059 BSON_ASSERT (selector );
20602060 BSON_ASSERT (update );
2061- BSON_ASSERT (bson_empty0 (reply ));
20622061
20632062 if (update_opts -> upsert ) {
20642063 bson_append_bool (extra , "upsert" , 6 , true);
@@ -2139,6 +2138,7 @@ _mongoc_collection_update_or_replace (
21392138 & update_opts -> crud ,
21402139 & result );
21412140
2141+ _mongoc_bson_init_if_set (reply );
21422142 reply_initialized = true;
21432143
21442144 /* set fields described in CRUD spec for the UpdateResult */
@@ -2182,17 +2182,17 @@ mongoc_collection_update_one (mongoc_collection_t *collection,
21822182 BSON_ASSERT (collection );
21832183 BSON_ASSERT (update );
21842184
2185- _mongoc_bson_init_if_set (reply );
2186-
21872185 if (!_mongoc_update_one_opts_parse (
21882186 collection -> client , opts , & update_one_opts , error )) {
21892187 _mongoc_update_one_opts_cleanup (& update_one_opts );
2188+ _mongoc_bson_init_if_set (reply );
21902189 return false;
21912190 }
21922191
21932192 if (!_mongoc_validate_update (
21942193 update , update_one_opts .update .crud .validate , error )) {
21952194 _mongoc_update_one_opts_cleanup (& update_one_opts );
2195+ _mongoc_bson_init_if_set (reply );
21962196 return false;
21972197 }
21982198
@@ -2227,17 +2227,17 @@ mongoc_collection_update_many (mongoc_collection_t *collection,
22272227 BSON_ASSERT (collection );
22282228 BSON_ASSERT (update );
22292229
2230- _mongoc_bson_init_if_set (reply );
2231-
22322230 if (!_mongoc_update_many_opts_parse (
22332231 collection -> client , opts , & update_many_opts , error )) {
22342232 _mongoc_update_many_opts_cleanup (& update_many_opts );
2233+ _mongoc_bson_init_if_set (reply );
22352234 return false;
22362235 }
22372236
22382237 if (!_mongoc_validate_update (
22392238 update , update_many_opts .update .crud .validate , error )) {
22402239 _mongoc_update_many_opts_cleanup (& update_many_opts );
2240+ _mongoc_bson_init_if_set (reply );
22412241 return false;
22422242 }
22432243
@@ -2274,17 +2274,17 @@ mongoc_collection_replace_one (mongoc_collection_t *collection,
22742274 BSON_ASSERT (collection );
22752275 BSON_ASSERT (replacement );
22762276
2277- _mongoc_bson_init_if_set (reply );
2278-
22792277 if (!_mongoc_replace_one_opts_parse (
22802278 collection -> client , opts , & replace_one_opts , error )) {
22812279 _mongoc_replace_one_opts_cleanup (& replace_one_opts );
2280+ _mongoc_bson_init_if_set (reply );
22822281 return false;
22832282 }
22842283
22852284 if (!_mongoc_validate_replace (
22862285 replacement , replace_one_opts .update .crud .validate , error )) {
22872286 _mongoc_replace_one_opts_cleanup (& replace_one_opts );
2287+ _mongoc_bson_init_if_set (reply );
22882288 return false;
22892289 }
22902290
0 commit comments