Table of Contents

Class GridFSUploadStream<TFileId>

Namespace
MongoDB.Driver.GridFS
Assembly
MongoDB.Driver.GridFS.dll

Represents a Stream used by the application to write data to a GridFS file.

public abstract class GridFSUploadStream<TFileId> : Stream, IDisposable

Type Parameters

TFileId

The type of the file identifier.

Inheritance
GridFSUploadStream<TFileId>
Implements
Inherited Members

Properties

Id

Gets the id of the file being added to GridFS.

public abstract TFileId Id { get; }

Property Value

TFileId

The id of the file being added to GridFS.

Methods

Abort(CancellationToken)

Aborts an upload operation.

public abstract void Abort(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Remarks

Any partial results already written to the server are deleted when Abort is called.

AbortAsync(CancellationToken)

Aborts an upload operation.

public abstract Task AbortAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task.

Remarks

Any partial results already written to the server are deleted when AbortAsync is called.

Close(CancellationToken)

Closes the Stream and completes the upload operation.

public abstract void Close(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token.

Remarks

Any data remaining in the Stream is flushed to the server and the GridFS files collection document is written.

CloseAsync(CancellationToken)

Closes the Stream and completes the upload operation.

public abstract Task CloseAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task.

Remarks

Any data remaining in the Stream is flushed to the server and the GridFS files collection document is written.