File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
src/libmongoc/tests/unified Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1256,26 +1256,33 @@ test_run_distinct_workaround (test_t *test, bson_error_t *error)
12561256 /* Get the database/collection name from each collection entity. */
12571257 BSON_FOREACH (test -> test_file -> create_entities , iter )
12581258 {
1259- bson_t create_entity ;
12601259 bson_t entity_bson ;
12611260 char * coll_name = NULL ;
12621261 char * db_id = NULL ;
12631262 char * db_name = NULL ;
12641263 mongoc_database_t * db = NULL ;
12651264 bson_iter_t entity_iter ;
12661265
1267- bson_iter_bson (& iter , & create_entity );
1268- if (!bson_has_field (& create_entity , "collection" )) {
1269- continue ;
1270- }
12711266 if (!BSON_ITER_HOLDS_DOCUMENT (& iter )) {
12721267 test_set_error (error ,
12731268 "unexpected non-document createEntity: %s" ,
1274- tmp_json (& create_entity ));
1269+ bson_iter_key (& iter ));
12751270 goto done ;
12761271 }
12771272
12781273 bson_iter_recurse (& iter , & entity_iter );
1274+
1275+ if (!bson_iter_find (& entity_iter , "collection" )) {
1276+ continue ;
1277+ }
1278+
1279+ if (!BSON_ITER_HOLDS_DOCUMENT (& entity_iter )) {
1280+ test_set_error (error ,
1281+ "unexpected non-document in iter: %s" ,
1282+ bson_iter_key (& entity_iter ));
1283+ goto done ;
1284+ }
1285+
12791286 bson_iter_bson (& entity_iter , & entity_bson );
12801287
12811288 bp = bson_parser_new ();
You can’t perform that action at this time.
0 commit comments