private BulkMixedWriteOperation CreateAbortOperation()
        {
            var chunksCollectionNamespace = _bucket.GetChunksCollectionNamespace();
            var filter        = new BsonDocument("files_id", _idAsBsonValue);
            var deleteRequest = new DeleteRequest(filter)
            {
                Limit = 0
            };
            var requests = new WriteRequest[] { deleteRequest };
            var messageEncoderSettings = _bucket.GetMessageEncoderSettings();

            return(new BulkMixedWriteOperation(chunksCollectionNamespace, requests, messageEncoderSettings)
            {
                WriteConcern = _bucket.Options.WriteConcern
            });
        }
示例#2
0
        // methods
        public override async Task AbortAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            if (_aborted)
            {
                return;
            }
            ThrowIfClosedOrDisposed();
            _aborted = true;

            var chunksCollectionNamespace = _bucket.GetChunksCollectionNamespace();
            var filter        = new BsonDocument("files_id", _id);
            var deleteRequest = new DeleteRequest(filter)
            {
                Limit = 0
            };
            var requests = new WriteRequest[] { deleteRequest };
            var messageEncoderSettings = _bucket.GetMessageEncoderSettings();
            var operation = new BulkMixedWriteOperation(chunksCollectionNamespace, requests, messageEncoderSettings)
            {
                WriteConcern = _bucket.Options.WriteConcern
            };

            await operation.ExecuteAsync(_binding, cancellationToken).ConfigureAwait(false);
        }