Table of Contents

Method CreateViewAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

CreateViewAsync<TDocument, TResult>(string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)

Creates a view.

public virtual Task CreateViewAsync<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

viewName string

The name of the view.

viewOn string

The name of the collection that the view is on.

pipeline PipelineDefinition<TDocument, TResult>

The pipeline.

options CreateViewOptions<TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

Type Parameters

TDocument

The type of the input documents.

TResult

The type of the pipeline result documents.

CreateViewAsync<TDocument, TResult>(IClientSessionHandle, string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)

Creates a view.

public virtual Task CreateViewAsync<TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

viewName string

The name of the view.

viewOn string

The name of the collection that the view is on.

pipeline PipelineDefinition<TDocument, TResult>

The pipeline.

options CreateViewOptions<TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task.

Type Parameters

TDocument

The type of the input documents.

TResult

The type of the pipeline result documents.