diff options
Diffstat (limited to 'src/mongo/db/views/durable_view_catalog.cpp')
-rw-r--r-- | src/mongo/db/views/durable_view_catalog.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/views/durable_view_catalog.cpp b/src/mongo/db/views/durable_view_catalog.cpp index 361505220b8..900988f8dbd 100644 --- a/src/mongo/db/views/durable_view_catalog.cpp +++ b/src/mongo/db/views/durable_view_catalog.cpp @@ -54,13 +54,16 @@ #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kStorage - namespace mongo { namespace { void validateViewDefinitionBSON(OperationContext* opCtx, const BSONObj& viewDefinition, StringData dbName) { + // Internal callers should always pass in a valid 'dbName' against which to compare the + // 'viewDefinition'. + invariant(NamespaceString::validDBName(dbName)); + bool valid = true; for (const BSONElement& e : viewDefinition) { @@ -122,7 +125,7 @@ Status DurableViewCatalog::onExternalInsert(OperationContext* opCtx, const BSONObj& doc, const NamespaceString& name) { try { - validateViewDefinitionBSON(opCtx, doc, name.toString()); + validateViewDefinitionBSON(opCtx, doc, name.db()); } catch (const DBException& e) { return e.toStatus(); } @@ -132,9 +135,6 @@ Status DurableViewCatalog::onExternalInsert(OperationContext* opCtx, NamespaceString viewOn(name.db(), doc.getStringField("viewOn")); BSONArray pipeline(doc.getObjectField("pipeline")); BSONObj collation(doc.getObjectField("collation")); - // Set updateDurableViewCatalog to false because the view has already been inserted into the - // durable view catalog. - const bool updateDurableViewCatalog = false; return catalog->createView(opCtx, viewName, @@ -142,7 +142,7 @@ Status DurableViewCatalog::onExternalInsert(OperationContext* opCtx, pipeline, collation, view_catalog_helpers::validatePipeline, - updateDurableViewCatalog); + CollectionCatalog::ViewUpsertMode::kAlreadyDurableView); } void DurableViewCatalog::onSystemViewsCollectionDrop(OperationContext* opCtx, |