diff options
author | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2019-08-28 00:47:34 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-08-28 00:47:34 +0000 |
commit | 18f95f8ad46c685d8529dba2d5655b3e4ef968c1 (patch) | |
tree | 1c7d69da6eedf16d1c317ca1e9c4b36bc460edd6 /src/mongo/db/catalog/rename_collection.cpp | |
parent | 33621eab05f101b161ae8834cb8efc3980e8f17f (diff) | |
download | mongo-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/mongo/db/catalog/rename_collection.cpp')
-rw-r--r-- | src/mongo/db/catalog/rename_collection.cpp | 6 |
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; |