public BulkInsertOpeartionResult BulkDeleteDocuments(string query, int?deleteBatchSize = null, CancellationToken cancellationToken = default(CancellationToken)) { _metaDataOperator.AddActivity(_databaseName, _collectionName, DateTimeOffset.Now, ActivityStrength.Hot).Wait(); lock (bulkDeleteLock) { var scaleOperation = ScaleLogic.ScaleUpMaxCollectionAsync(_client, _metaDataOperator, _databaseName, _collectionName, _minRu, _maxRu).GetAwaiter().GetResult(); var response = _bulkExecutor.BulkDeleteAsync(query, deleteBatchSize, cancellationToken).GetAwaiter().GetResult(); return(new BulkInsertOpeartionResult { ScaleOperations = new List <ScaleOperation>() { scaleOperation }, OperationSuccess = true }); } }
public BulkInsertOpeartionResult BulkInsertDocuments(IEnumerable <object> documents, bool enableUpsert = false, bool disableAutomaticIdGeneration = true, int?maxConcurrencyPerPartitionKeyRange = null, int?maxInMemorySortingBatchSize = null, CancellationToken cancellationToken = default(CancellationToken)) { _metaDataOperator.AddActivity(_databaseName, _collectionName, DateTimeOffset.Now, ActivityStrength.Hot).Wait(); lock (bulkInsertLock) { var scaleOperation = ScaleLogic.ScaleUpMaxCollectionAsync(_client, _metaDataOperator, _databaseName, _collectionName, _minRu, _maxRu).GetAwaiter().GetResult(); _bulkExecutor.BulkImportAsync(documents, enableUpsert, disableAutomaticIdGeneration, maxConcurrencyPerPartitionKeyRange, maxInMemorySortingBatchSize, cancellationToken).Wait(); return(new BulkInsertOpeartionResult { ScaleOperations = new List <ScaleOperation>() { scaleOperation }, OperationSuccess = true }); } }