File tree 1 file changed +13
-6
lines changed
src/libmongoc/tests/unified
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)
1256
1256
/* Get the database/collection name from each collection entity. */
1257
1257
BSON_FOREACH (test -> test_file -> create_entities , iter )
1258
1258
{
1259
- bson_t create_entity ;
1260
1259
bson_t entity_bson ;
1261
1260
char * coll_name = NULL ;
1262
1261
char * db_id = NULL ;
1263
1262
char * db_name = NULL ;
1264
1263
mongoc_database_t * db = NULL ;
1265
1264
bson_iter_t entity_iter ;
1266
1265
1267
- bson_iter_bson (& iter , & create_entity );
1268
- if (!bson_has_field (& create_entity , "collection" )) {
1269
- continue ;
1270
- }
1271
1266
if (!BSON_ITER_HOLDS_DOCUMENT (& iter )) {
1272
1267
test_set_error (error ,
1273
1268
"unexpected non-document createEntity: %s" ,
1274
- tmp_json (& create_entity ));
1269
+ bson_iter_key (& iter ));
1275
1270
goto done ;
1276
1271
}
1277
1272
1278
1273
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
+
1279
1286
bson_iter_bson (& entity_iter , & entity_bson );
1280
1287
1281
1288
bp = bson_parser_new ();
You can’t perform that action at this time.
0 commit comments