@@ -2058,7 +2058,6 @@ _mongoc_collection_update_or_replace (
2058
2058
BSON_ASSERT (collection );
2059
2059
BSON_ASSERT (selector );
2060
2060
BSON_ASSERT (update );
2061
- BSON_ASSERT (bson_empty0 (reply ));
2062
2061
2063
2062
if (update_opts -> upsert ) {
2064
2063
bson_append_bool (extra , "upsert" , 6 , true);
@@ -2139,6 +2138,7 @@ _mongoc_collection_update_or_replace (
2139
2138
& update_opts -> crud ,
2140
2139
& result );
2141
2140
2141
+ _mongoc_bson_init_if_set (reply );
2142
2142
reply_initialized = true;
2143
2143
2144
2144
/* set fields described in CRUD spec for the UpdateResult */
@@ -2182,17 +2182,17 @@ mongoc_collection_update_one (mongoc_collection_t *collection,
2182
2182
BSON_ASSERT (collection );
2183
2183
BSON_ASSERT (update );
2184
2184
2185
- _mongoc_bson_init_if_set (reply );
2186
-
2187
2185
if (!_mongoc_update_one_opts_parse (
2188
2186
collection -> client , opts , & update_one_opts , error )) {
2189
2187
_mongoc_update_one_opts_cleanup (& update_one_opts );
2188
+ _mongoc_bson_init_if_set (reply );
2190
2189
return false;
2191
2190
}
2192
2191
2193
2192
if (!_mongoc_validate_update (
2194
2193
update , update_one_opts .update .crud .validate , error )) {
2195
2194
_mongoc_update_one_opts_cleanup (& update_one_opts );
2195
+ _mongoc_bson_init_if_set (reply );
2196
2196
return false;
2197
2197
}
2198
2198
@@ -2227,17 +2227,17 @@ mongoc_collection_update_many (mongoc_collection_t *collection,
2227
2227
BSON_ASSERT (collection );
2228
2228
BSON_ASSERT (update );
2229
2229
2230
- _mongoc_bson_init_if_set (reply );
2231
-
2232
2230
if (!_mongoc_update_many_opts_parse (
2233
2231
collection -> client , opts , & update_many_opts , error )) {
2234
2232
_mongoc_update_many_opts_cleanup (& update_many_opts );
2233
+ _mongoc_bson_init_if_set (reply );
2235
2234
return false;
2236
2235
}
2237
2236
2238
2237
if (!_mongoc_validate_update (
2239
2238
update , update_many_opts .update .crud .validate , error )) {
2240
2239
_mongoc_update_many_opts_cleanup (& update_many_opts );
2240
+ _mongoc_bson_init_if_set (reply );
2241
2241
return false;
2242
2242
}
2243
2243
@@ -2274,17 +2274,17 @@ mongoc_collection_replace_one (mongoc_collection_t *collection,
2274
2274
BSON_ASSERT (collection );
2275
2275
BSON_ASSERT (replacement );
2276
2276
2277
- _mongoc_bson_init_if_set (reply );
2278
-
2279
2277
if (!_mongoc_replace_one_opts_parse (
2280
2278
collection -> client , opts , & replace_one_opts , error )) {
2281
2279
_mongoc_replace_one_opts_cleanup (& replace_one_opts );
2280
+ _mongoc_bson_init_if_set (reply );
2282
2281
return false;
2283
2282
}
2284
2283
2285
2284
if (!_mongoc_validate_replace (
2286
2285
replacement , replace_one_opts .update .crud .validate , error )) {
2287
2286
_mongoc_replace_one_opts_cleanup (& replace_one_opts );
2287
+ _mongoc_bson_init_if_set (reply );
2288
2288
return false;
2289
2289
}
2290
2290
0 commit comments