// methods private Task <WriteConcernResult> ExecuteProtocolAsync(IChannelHandle channel, WriteConcern batchWriteConcern, Func <bool> shouldSendGetLastError, CancellationToken cancellationToken) { return(channel.InsertAsync <TDocument>( _collectionNamespace, batchWriteConcern, _serializer, _messageEncoderSettings, _documentSource, _maxBatchCount, _maxMessageSize, _continueOnError, shouldSendGetLastError, cancellationToken)); }
protected override Task <WriteConcernResult> ExecuteProtocolAsync(IChannelHandle channel, InsertRequest request, CancellationToken cancellationToken) { var documentSource = new BatchableSource <BsonDocument>(new[] { request.Document }); return(channel.InsertAsync( CollectionNamespace, WriteConcern, BsonDocumentSerializer.Instance, MessageEncoderSettings, documentSource, MaxBatchCount, MaxBatchLength, !IsOrdered, // continueOnError null, // shouldSendGetLastError cancellationToken)); }
// methods protected override Task<WriteConcernResult> ExecuteProtocolAsync(IChannelHandle channel, WriteRequest request, CancellationToken cancellationToken) { var insertRequest = (InsertRequest)request; var documentSource = new BatchableSource<BsonDocument>(new[] { insertRequest.Document }); return channel.InsertAsync( CollectionNamespace, WriteConcern, BsonDocumentSerializer.Instance, MessageEncoderSettings, documentSource, MaxBatchCount, MaxBatchLength, !IsOrdered, // continueOnError null, // shouldSendGetLastError cancellationToken); }