summaryrefslogtreecommitdiff
path: root/src/mongo/db/views/view_catalog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/views/view_catalog.cpp')
-rw-r--r--src/mongo/db/views/view_catalog.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp
index 3809ca0b94c..8c59710941e 100644
--- a/src/mongo/db/views/view_catalog.cpp
+++ b/src/mongo/db/views/view_catalog.cpp
@@ -177,10 +177,11 @@ Status ViewCatalog::_upsertIntoGraph(OperationContext* opCtx, const ViewDefiniti
// will also return the set of involved namespaces.
auto pipelineStatus = _validatePipeline_inlock(opCtx, viewDef);
if (!pipelineStatus.isOK()) {
- uassert(pipelineStatus.getStatus().code(),
- str::stream() << "Invalid pipeline for view " << viewDef.name().ns() << "; "
- << pipelineStatus.getStatus().reason(),
- !needsValidation);
+ if (needsValidation) {
+ uassertStatusOKWithContext(pipelineStatus.getStatus(),
+ str::stream() << "Invalid pipeline for view "
+ << viewDef.name().ns());
+ }
return pipelineStatus.getStatus();
}