summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbdirectclient.cpp
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@mongodb.com>2019-10-07 20:11:46 +0000
committerevergreen <evergreen@mongodb.com>2019-10-07 20:11:46 +0000
commit8784ad77c5a1e2327c5c0b9f50343e0186f6bfab (patch)
tree32180abaaab0be6d8eda0c35d74aba6d1a213e54 /src/mongo/db/dbdirectclient.cpp
parent7538504cb584720c2cbbc6d44ea62d0743b41fcf (diff)
downloadmongo-8784ad77c5a1e2327c5c0b9f50343e0186f6bfab.tar.gz
SERVER-43273 Add UUID support to count and getIndexSpecs in DBClient
Diffstat (limited to 'src/mongo/db/dbdirectclient.cpp')
-rw-r--r--src/mongo/db/dbdirectclient.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/dbdirectclient.cpp b/src/mongo/db/dbdirectclient.cpp
index d5ce4367612..be41cc3c86a 100644
--- a/src/mongo/db/dbdirectclient.cpp
+++ b/src/mongo/db/dbdirectclient.cpp
@@ -173,14 +173,14 @@ unique_ptr<DBClientCursor> DBDirectClient::query(const NamespaceStringOrUUID& ns
}
unsigned long long DBDirectClient::count(
- const string& ns, const BSONObj& query, int options, int limit, int skip) {
+ const NamespaceStringOrUUID nsOrUuid, const BSONObj& query, int options, int limit, int skip) {
DirectClientScope directClientScope(_opCtx);
- BSONObj cmdObj = _countCmd(ns, query, options, limit, skip);
+ BSONObj cmdObj = _countCmd(nsOrUuid, query, options, limit, skip);
- NamespaceString nsString(ns);
+ auto dbName = (nsOrUuid.uuid() ? nsOrUuid.dbname() : (*nsOrUuid.nss()).db().toString());
auto result = CommandHelpers::runCommandDirectly(
- _opCtx, OpMsgRequest::fromDBAndBody(nsString.db(), std::move(cmdObj)));
+ _opCtx, OpMsgRequest::fromDBAndBody(dbName, std::move(cmdObj)));
uassertStatusOK(getStatusFromCommandResult(result));
return static_cast<unsigned long long>(result["n"].numberLong());