@@ -377,15 +377,9 @@ TEST_CASE("integration tests for client metadata handshake feature") {
377
377
378
378
auto run_test = [app_name](const client& client) {
379
379
mongocxx::database db = client[" admin" ];
380
- auto current_op = db.run_command (make_document (kvp (" currentOp" , 1 )));
381
- auto current_op_view = current_op.view ();
382
-
383
- auto in_prog = current_op_view[" inprog" ].get_array ().value ;
380
+ auto cursor = db.aggregate (pipeline ().current_op (make_document ()));
384
381
bool found_op = false ;
385
-
386
- for (auto && it : in_prog) {
387
- auto op_view = it.get_document ().view ();
388
-
382
+ for (auto && op_view : cursor) {
389
383
if (!op_view[" appName" ] ||
390
384
op_view[" appName" ].get_string ().value != stdx::string_view (app_name)) {
391
385
continue ;
@@ -395,29 +389,24 @@ TEST_CASE("integration tests for client metadata handshake feature") {
395
389
396
390
std::string server_version = test_util::get_server_version (client);
397
391
398
- // clientMetadata not returned until 3.5.8.
399
- if (test_util::compare_versions (server_version, " 3.5.8" ) >= 0 ) {
400
- REQUIRE (op_view[" clientMetadata" ]);
401
- auto metadata = op_view[" clientMetadata" ].get_document ();
402
- auto metadata_view = metadata.view ();
403
-
404
- REQUIRE (metadata_view[" application" ]);
405
- auto application = metadata_view[" application" ].get_document ();
406
- REQUIRE (application.view ()[" name" ].get_string ().value ==
407
- stdx::string_view (app_name));
408
-
409
- REQUIRE (metadata_view[" driver" ]);
410
- auto driver = metadata_view[" driver" ].get_document ();
411
- auto driver_view = driver.view ();
412
- REQUIRE (driver_view[" name" ].get_string ().value ==
413
- stdx::string_view{" mongoc / mongocxx" });
414
- auto version =
415
- bsoncxx::string::to_string (driver_view[" version" ].get_string ().value );
416
- REQUIRE (version.find (MONGOCXX_VERSION_STRING) != std::string::npos);
417
-
418
- REQUIRE (metadata_view[" os" ]);
419
- REQUIRE (metadata_view[" os" ].get_document ().view ()[" type" ]);
420
- }
392
+ REQUIRE (op_view[" clientMetadata" ]);
393
+ auto metadata = op_view[" clientMetadata" ].get_document ();
394
+ auto metadata_view = metadata.view ();
395
+
396
+ REQUIRE (metadata_view[" application" ]);
397
+ auto application = metadata_view[" application" ].get_document ();
398
+ REQUIRE (application.view ()[" name" ].get_string ().value == stdx::string_view (app_name));
399
+
400
+ REQUIRE (metadata_view[" driver" ]);
401
+ auto driver = metadata_view[" driver" ].get_document ();
402
+ auto driver_view = driver.view ();
403
+ REQUIRE (driver_view[" name" ].get_string ().value ==
404
+ stdx::string_view{" mongoc / mongocxx" });
405
+ auto version = bsoncxx::string::to_string (driver_view[" version" ].get_string ().value );
406
+ REQUIRE (version.find (MONGOCXX_VERSION_STRING) != std::string::npos);
407
+
408
+ REQUIRE (metadata_view[" os" ]);
409
+ REQUIRE (metadata_view[" os" ].get_document ().view ()[" type" ]);
421
410
422
411
break ;
423
412
}
0 commit comments