Table of Contents

Class GridFSUploadStream

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

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

public class GridFSUploadStream : DelegatingStream, IDisposable
Inheritance
GridFSUploadStream
Implements
Inherited Members

Properties

Id

Gets the id of the file being added to GridFS.

public ObjectId Id { get; }

Property Value

ObjectId

The id of the file being added to GridFS.

Methods

Abort(CancellationToken)

Aborts an upload operation.

public 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 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 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 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.