summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2019-08-28 00:47:34 +0000
committerevergreen <evergreen@mongodb.com>2019-08-28 00:47:34 +0000
commit18f95f8ad46c685d8529dba2d5655b3e4ef968c1 (patch)
tree1c7d69da6eedf16d1c317ca1e9c4b36bc460edd6 /src
parent33621eab05f101b161ae8834cb8efc3980e8f17f (diff)
downloadmongo-18f95f8ad46c685d8529dba2d5655b3e4ef968c1.tar.gz
SERVER-41947 Disallow using the system.views collection name as the source or target names in the rename command
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index 13914e84a22..472a7f46868 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -747,6 +747,12 @@ Status renameCollection(OperationContext* opCtx,
<< source);
}
+ if (source.isSystemDotViews() || target.isSystemDotViews()) {
+ return Status(
+ ErrorCodes::IllegalOperation,
+ "renaming system.views collection or renaming to system.views is not allowed");
+ }
+
const std::string dropTargetMsg =
options.dropTarget ? " and drop " + target.toString() + "." : ".";
log() << "renameCollectionForCommand: rename " << source << " to " << target << dropTargetMsg;