summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSophia Tan <sophia_tll@hotmail.com>2022-09-27 16:25:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-27 17:33:22 +0000
commit3fb46b7ac816b306c13160765917f57dac0e078e (patch)
tree0818871b2c3ccdedabd5894474a44dc6071093db /src
parenta64f65df630f11764381e65e33e44db62d14766d (diff)
downloadmongo-3fb46b7ac816b306c13160765917f57dac0e078e.tar.gz
SERVER-68347 Ensure createIndexes, dropIndexes, and listIndexes work in multitenant environment
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/drop_indexes.cpp2
-rw-r--r--src/mongo/db/commands/create_indexes_cmd.cpp5
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp3
-rw-r--r--src/mongo/db/commands/list_indexes.cpp4
4 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/catalog/drop_indexes.cpp b/src/mongo/db/catalog/drop_indexes.cpp
index 8ee4b3cc43f..25d50406adc 100644
--- a/src/mongo/db/catalog/drop_indexes.cpp
+++ b/src/mongo/db/catalog/drop_indexes.cpp
@@ -403,7 +403,7 @@ DropIndexesReply dropIndexes(OperationContext* opCtx,
uassertStatusOK(checkView(opCtx, nss, collection->getCollection()));
const UUID collectionUUID = (*collection)->uuid();
- const NamespaceStringOrUUID dbAndUUID = {nss.db().toString(), collectionUUID};
+ const NamespaceStringOrUUID dbAndUUID = {nss.dbName(), collectionUUID};
uassertStatusOK(checkReplState(opCtx, dbAndUUID, collection->getCollection()));
if (!serverGlobalParams.quiet.load()) {
LOGV2(51806,
diff --git a/src/mongo/db/commands/create_indexes_cmd.cpp b/src/mongo/db/commands/create_indexes_cmd.cpp
index 233d60bba58..f6da49a5444 100644
--- a/src/mongo/db/commands/create_indexes_cmd.cpp
+++ b/src/mongo/db/commands/create_indexes_cmd.cpp
@@ -482,7 +482,7 @@ CreateIndexesReply runCreateIndexesWithCoordinator(OperationContext* opCtx,
boost::optional<UUID> collectionUUID;
CreateIndexesReply reply;
{
- AutoGetDb autoDb(opCtx, ns.db(), MODE_IX);
+ AutoGetDb autoDb(opCtx, ns.dbName(), MODE_IX);
assertNoMovePrimaryInProgress(opCtx, ns);
if (!repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, ns)) {
@@ -706,6 +706,9 @@ CreateIndexesReply runCreateIndexesWithCoordinator(OperationContext* opCtx,
*/
class CmdCreateIndexes : public CreateIndexesCmdVersion1Gen<CmdCreateIndexes> {
public:
+ bool allowedWithSecurityToken() const final {
+ return true;
+ }
class Invocation final : public InvocationBase {
public:
using InvocationBase::InvocationBase;
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index ae15287286e..86d66718499 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -79,6 +79,9 @@ public:
std::string help() const override {
return "drop indexes for a collection";
}
+ bool allowedWithSecurityToken() const final {
+ return true;
+ }
class Invocation final : public InvocationBaseGen {
public:
using InvocationBaseGen::InvocationBaseGen;
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index 4312a142906..c61c6781e50 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -215,6 +215,10 @@ public:
return "list indexes for a collection";
}
+ bool allowedWithSecurityToken() const final {
+ return true;
+ }
+
class Invocation final : public InvocationBaseGen {
public:
using InvocationBaseGen::InvocationBaseGen;