summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2020-06-16 12:42:46 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-16 22:03:37 +0000
commit8a69ffaf15ef093649090d6695227107d24ea666 (patch)
tree9577f8cef3b6f8eae99f2130004fed9f54ff41b6
parent57edf434219c9659354f01fb6bf4f4e6c0370bc4 (diff)
downloadmongo-8a69ffaf15ef093649090d6695227107d24ea666.tar.gz
SERVER-48891 reIndex should not lookup nonexistent database in ViewCatalog
(cherry picked from commit b9874b9c81e529e661b6615dd2ce5948e6db15bc)
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index 0d3f7927711..dbc317472bf 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -132,7 +132,8 @@ public:
AutoGetCollection autoColl(opCtx, toReIndexNss, MODE_X);
Collection* collection = autoColl.getCollection();
if (!collection) {
- if (ViewCatalog::get(autoColl.getDb())->lookup(opCtx, toReIndexNss.ns()))
+ auto db = autoColl.getDb();
+ if (db && ViewCatalog::get(db)->lookup(opCtx, toReIndexNss.ns()))
uasserted(ErrorCodes::CommandNotSupportedOnView, "can't re-index a view");
else
uasserted(ErrorCodes::NamespaceNotFound, "collection does not exist");