diff options
author | Dan Larkin-York <dan.larkin-york@mongodb.com> | 2021-02-03 17:42:39 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-05 05:48:02 +0000 |
commit | 03954159a4260ec6132669b2e94c9d9cfd5628c0 (patch) | |
tree | 682dfeec10fdf61af3a832e7941e3b555bfc6ced /src/mongo/db/catalog_raii.cpp | |
parent | 709dca02b250194115e5a79fa6c6a4daa9b296a0 (diff) | |
download | mongo-03954159a4260ec6132669b2e94c9d9cfd5628c0.tar.gz |
SERVER-53963 Improve error message for unsupported operations on time-series collections
Diffstat (limited to 'src/mongo/db/catalog_raii.cpp')
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index e5c2043b152..1c3ddcdeee3 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -172,6 +172,10 @@ AutoGetCollection::AutoGetCollection(OperationContext* opCtx, _view = ViewCatalog::get(db)->lookup(opCtx, _resolvedNss.ns()); uassert(ErrorCodes::CommandNotSupportedOnView, + str::stream() << "Namespace " << _resolvedNss.ns() << " is a timeseries collection", + !_view || viewMode == AutoGetCollectionViewMode::kViewsPermitted || + !_view->timeseries()); + uassert(ErrorCodes::CommandNotSupportedOnView, str::stream() << "Namespace " << _resolvedNss.ns() << " is a view, not a collection", !_view || viewMode == AutoGetCollectionViewMode::kViewsPermitted); } @@ -280,6 +284,10 @@ AutoGetCollectionLockFree::AutoGetCollectionLockFree(OperationContext* opCtx, _view = viewCatalog->lookup(opCtx, _resolvedNss.ns()); uassert(ErrorCodes::CommandNotSupportedOnView, + str::stream() << "Namespace " << _resolvedNss.ns() << " is a timeseries collection", + !_view || viewMode == AutoGetCollectionViewMode::kViewsPermitted || + !_view->timeseries()); + uassert(ErrorCodes::CommandNotSupportedOnView, str::stream() << "Namespace " << _resolvedNss.ns() << " is a view, not a collection", !_view || viewMode == AutoGetCollectionViewMode::kViewsPermitted); } |