diff options
author | Sophia Tan <sophia_tll@hotmail.com> | 2023-01-23 16:23:20 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-23 18:12:53 +0000 |
commit | 056b0578ea08a530dbee00986c0f4a651771628a (patch) | |
tree | 2f75472d62f86b9c2d117e5531f8ea5e2a720887 /src/mongo/db/commands | |
parent | 368ae38dea1386062c6c7a1591c469c7bc9d56fe (diff) | |
download | mongo-056b0578ea08a530dbee00986c0f4a651771628a.tar.gz |
SERVER-72948 Change DBClient runCommand function to use DatabaseName object
Diffstat (limited to 'src/mongo/db/commands')
4 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/commands/analyze_cmd.cpp b/src/mongo/db/commands/analyze_cmd.cpp index cad6d7c8b57..8461f923181 100644 --- a/src/mongo/db/commands/analyze_cmd.cpp +++ b/src/mongo/db/commands/analyze_cmd.cpp @@ -214,7 +214,7 @@ public: // Run Aggregate BSONObj analyzeResult; - client.runCommand(nss.db().toString(), + client.runCommand(nss.dbName(), analyzeCommandAsAggregationCommand(opCtx, nss.db(), nss.coll(), diff --git a/src/mongo/db/commands/create_indexes_test.cpp b/src/mongo/db/commands/create_indexes_test.cpp index b7977ef5e67..1477ab3dcb0 100644 --- a/src/mongo/db/commands/create_indexes_test.cpp +++ b/src/mongo/db/commands/create_indexes_test.cpp @@ -68,7 +68,7 @@ TEST_F(CreateIndexesTest, CreateIndexesFailsWhenIndexBuildsCollectionIsMissing) "createIndexes" << nss.coll() << "indexes" << BSON_ARRAY(index) << "commitQuorum" << 0); BSONObj result; // This should fail since config.system.indexBuilds does not exist. - ASSERT_FALSE(client.runCommand(nss.db().toString(), createIndexesCmdObj, result)) << result; + ASSERT_FALSE(client.runCommand(nss.dbName(), createIndexesCmdObj, result)) << result; ASSERT(result.hasField("code")); ASSERT_EQ(result.getIntField("code"), 6325700); } diff --git a/src/mongo/db/commands/external_data_source_commands_test.cpp b/src/mongo/db/commands/external_data_source_commands_test.cpp index 5303c77e757..217773fa023 100644 --- a/src/mongo/db/commands/external_data_source_commands_test.cpp +++ b/src/mongo/db/commands/external_data_source_commands_test.cpp @@ -31,6 +31,7 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/client/dbclient_cursor.h" +#include "mongo/db/database_name.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/pipeline/aggregation_request_helper.h" #include "mongo/db/query/query_knobs_gen.h" @@ -132,9 +133,12 @@ protected: ServiceContext::UniqueOperationContext _uniqueOpCtx{makeOperationContext()}; OperationContext* _opCtx{_uniqueOpCtx.get()}; - static constexpr auto kDatabaseName = "external_data_source"; + static const DatabaseName kDatabaseName; }; +const DatabaseName ExternalDataSourceCommandsTest::kDatabaseName = + DatabaseName(boost::none, "external_data_source"); + TEST_F(ExternalDataSourceCommandsTest, SimpleScanAggRequest) { const auto nDocs = _random.nextInt32(100) + 1; std::vector<BSONObj> srcDocs = generateRandomSimpleDocs(nDocs); diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp index dfa4471bacf..8c9f621f0c2 100644 --- a/src/mongo/db/commands/feature_compatibility_version.cpp +++ b/src/mongo/db/commands/feature_compatibility_version.cpp @@ -252,7 +252,7 @@ void runUpdateCommand(OperationContext* opCtx, const FeatureCompatibilityVersion // Update the featureCompatibilityVersion document stored in the server configuration // collection. BSONObj updateResult; - client.runCommand(nss.db().toString(), updateCmd.obj(), updateResult); + client.runCommand(nss.dbName(), updateCmd.obj(), updateResult); uassertStatusOK(getStatusFromWriteCommandReply(updateResult)); } |