Skip to content

Commit 37dc570

Browse files
committed
CXX-1552 remove wire_version < 3
1 parent 20ff94f commit 37dc570

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

src/mongocxx/test/collection.cpp

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -823,12 +823,7 @@ TEST_CASE("CRUD functionality", "[driver::collection]") {
823823
auto doc = make_document(kvp("x", 1));
824824
coll.insert_one(doc.view());
825825

826-
if (test_util::get_max_wire_version(mongodb_client) >= 2) {
827-
REQUIRE_THROWS_AS(coll.count(doc.view(), count_opts), operation_exception);
828-
} else {
829-
// Old server versions ignore hint sent with count.
830-
REQUIRE(1 == coll.count(doc.view(), count_opts));
831-
}
826+
REQUIRE_THROWS_AS(coll.count(doc.view(), count_opts), operation_exception);
832827
}
833828

834829
SECTION("count with collation", "[collection]") {
@@ -1785,19 +1780,14 @@ TEST_CASE("CRUD functionality", "[driver::collection]") {
17851780
pipeline.out(bsoncxx::string::to_string(coll.name()));
17861781
auto cursor = coll.aggregate(pipeline);
17871782

1788-
if (test_util::get_max_wire_version(mongodb_client) >= 1) {
1789-
// The server supports out().
1790-
auto results = get_results(std::move(cursor));
1791-
REQUIRE(results.empty());
1783+
// The server supports out().
1784+
auto results = get_results(std::move(cursor));
1785+
REQUIRE(results.empty());
17921786

1793-
auto collection_contents = get_results(coll.find({}));
1794-
REQUIRE(collection_contents.size() == 1);
1795-
REQUIRE(collection_contents[0].view()["x"].get_int32() == 1);
1796-
REQUIRE(!collection_contents[0].view()["y"]);
1797-
} else {
1798-
// The server does not support out().
1799-
REQUIRE_THROWS_AS(get_results(std::move(cursor)), operation_exception);
1800-
}
1787+
auto collection_contents = get_results(coll.find({}));
1788+
REQUIRE(collection_contents.size() == 1);
1789+
REQUIRE(collection_contents[0].view()["x"].get_int32() == 1);
1790+
REQUIRE(!collection_contents[0].view()["y"]);
18011791
}
18021792

18031793
SECTION("out with bypass_document_validation", "[collection]") {
@@ -1880,16 +1870,11 @@ TEST_CASE("CRUD functionality", "[driver::collection]") {
18801870
kvp("else", "$$DESCEND")))));
18811871
auto cursor = coll.aggregate(pipeline);
18821872

1883-
if (test_util::get_max_wire_version(mongodb_client) >= 1) {
1884-
// The server supports redact().
1885-
auto results = get_results(std::move(cursor));
1886-
REQUIRE(results.size() == 1);
1887-
REQUIRE(!results[0].view()["x"]);
1888-
REQUIRE(results[0].view()["y"].get_int32() == 1);
1889-
} else {
1890-
// The server does not support redact().
1891-
REQUIRE_THROWS_AS(get_results(std::move(cursor)), operation_exception);
1892-
}
1873+
// The server supports redact().
1874+
auto results = get_results(std::move(cursor));
1875+
REQUIRE(results.size() == 1);
1876+
REQUIRE(!results[0].view()["x"]);
1877+
REQUIRE(results[0].view()["y"].get_int32() == 1);
18931878
}
18941879

18951880
SECTION("replace_root") {

0 commit comments

Comments
 (0)