summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/clienttests.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2021-12-21 11:15:42 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-21 11:55:50 +0000
commit19080405d9c7d08b54e70228a92d237223f2885c (patch)
tree73748cedfa62252c21968fdd4d0290972bbf3641 /src/mongo/dbtests/clienttests.cpp
parent58ca93e30a6436f47a8e8eaa3ddc831e376965dc (diff)
downloadmongo-19080405d9c7d08b54e70228a92d237223f2885c.tar.gz
SERVER-61385 Migrate callers of 'DBClientBase::query()' legacy API to the modern 'find()' API
There are a handful of remaining callers of the legacy API, either using the exhaust option or which are involved in a code path which still relies on the OP_QUERY-inspired BSON format. These should be cleaned up as follow-up work.
Diffstat (limited to 'src/mongo/dbtests/clienttests.cpp')
-rw-r--r--src/mongo/dbtests/clienttests.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp
index c595aa018c7..9bebe9f636e 100644
--- a/src/mongo/dbtests/clienttests.cpp
+++ b/src/mongo/dbtests/clienttests.cpp
@@ -158,8 +158,9 @@ public:
ASSERT_OK(dbtests::createIndex(&opCtx, ns(), BSON("a" << 1 << "b" << 1)));
- unique_ptr<DBClientCursor> c =
- db.query(NamespaceString(ns()), BSONObj{}, Query().sort(BSON("a" << 1 << "b" << 1)));
+ FindCommandRequest findRequest{NamespaceString{ns()}};
+ findRequest.setSort(BSON("a" << 1 << "b" << 1));
+ unique_ptr<DBClientCursor> c = db.find(std::move(findRequest));
ASSERT_EQUALS(1111, c->itcount());
}
};
@@ -176,8 +177,9 @@ public:
db.insert(ns(), BSON("i" << i));
}
- unique_ptr<DBClientCursor> c =
- db.query(NamespaceString(ns()), BSONObj{}, Query().sort(BSON("i" << 1)));
+ FindCommandRequest findRequest{NamespaceString{ns()}};
+ findRequest.setSort(BSON("i" << 1));
+ std::unique_ptr<DBClientCursor> c = db.find(std::move(findRequest));
BSONObj o = c->next();
ASSERT(c->more());