summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/list_indexes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/list_indexes.cpp')
-rw-r--r--src/mongo/db/commands/list_indexes.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index a050e9adfff..74b75cfeffa 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -120,6 +120,7 @@ public:
const string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
+ Lock::DBLock dbSLock(opCtx, dbname, MODE_IS);
const NamespaceString ns(parseNsOrUUID(opCtx, dbname, cmdObj));
const long long defaultBatchSize = std::numeric_limits<long long>::max();
long long batchSize;
@@ -129,7 +130,7 @@ public:
return appendCommandStatus(result, parseCursorStatus);
}
- AutoGetCollectionForReadCommand autoColl(opCtx, ns);
+ AutoGetCollectionForReadCommand autoColl(opCtx, ns, std::move(dbSLock));
if (!autoColl.getDb()) {
return appendCommandStatus(
result,