diff options
author | David Storch <david.storch@mongodb.com> | 2021-12-21 11:15:42 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-21 11:55:50 +0000 |
commit | 19080405d9c7d08b54e70228a92d237223f2885c (patch) | |
tree | 73748cedfa62252c21968fdd4d0290972bbf3641 /src/mongo/db/rs_local_client.cpp | |
parent | 58ca93e30a6436f47a8e8eaa3ddc831e376965dc (diff) | |
download | mongo-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/db/rs_local_client.cpp')
-rw-r--r-- | src/mongo/db/rs_local_client.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/db/rs_local_client.cpp b/src/mongo/db/rs_local_client.cpp index 6fdc49907f3..65cf9a284fa 100644 --- a/src/mongo/db/rs_local_client.cpp +++ b/src/mongo/db/rs_local_client.cpp @@ -139,18 +139,20 @@ StatusWith<Shard::QueryResponse> RSLocalClient::queryOnce( } DBDirectClient client(opCtx); - Query querySettings; + FindCommandRequest findRequest{nss}; + findRequest.setFilter(query); if (!sort.isEmpty()) { - querySettings.sort(sort); + findRequest.setSort(sort); } if (hint) { - querySettings.hint(*hint); + findRequest.setHint(*hint); + } + if (limit) { + findRequest.setLimit(*limit); } - querySettings.readPref(readPref.pref, BSONArray()); try { - std::unique_ptr<DBClientCursor> cursor = - client.query(nss, query, querySettings, limit.get_value_or(0)); + std::unique_ptr<DBClientCursor> cursor = client.find(std::move(findRequest), readPref); if (!cursor) { return {ErrorCodes::OperationFailed, |