Пример #1
0
 private WriteConcernResult ExecuteProtocol(IChannelHandle channel, Batch batch, CancellationToken cancellationToken)
 {
     return(channel.Insert <TDocument>(
                _collectionNamespace,
                batch.WriteConcern,
                _serializer,
                _messageEncoderSettings,
                batch.Documents,
                _maxBatchCount,
                _maxMessageSize,
                _continueOnError,
                batch.ShouldSendGetLastError,
                cancellationToken));
 }
Пример #2
0
        //  methods
        protected override WriteConcernResult ExecuteProtocol(IChannelHandle channel, InsertRequest request, CancellationToken cancellationToken)
        {
            var documentSource = new BatchableSource <BsonDocument>(new[] { request.Document });

            return(channel.Insert(
                       CollectionNamespace,
                       WriteConcern,
                       BsonDocumentSerializer.Instance,
                       MessageEncoderSettings,
                       documentSource,
                       MaxBatchCount,
                       MaxBatchLength,
                       !IsOrdered, // continueOnError
                       null,       // shouldSendGetLastError
                       cancellationToken));
        }
        //  methods
        protected override WriteConcernResult ExecuteProtocol(IChannelHandle channel, WriteRequest request, CancellationToken cancellationToken)
        {
            var insertRequest = (InsertRequest)request;
            var documentSource = new BatchableSource<BsonDocument>(new[] { insertRequest.Document });

            return channel.Insert(
                CollectionNamespace,
                WriteConcern,
                BsonDocumentSerializer.Instance,
                MessageEncoderSettings,
                documentSource,
                MaxBatchCount,
                MaxBatchLength,
                !IsOrdered, // continueOnError
                null, // shouldSendGetLastError
                cancellationToken);
        }