using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using MongoDbGenericRepository.DataAccess.Base;
using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository.DataAccess.Delete
{
///
/// The MongoDbEraser interface. used to delete documents from the collections.
///
public interface IMongoDbEraser : IDataAccessBase
{
///
/// Deletes a document.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// The document you want to delete.
/// An optional cancellation token
/// The number of documents deleted.
long DeleteOne(TDocument document, CancellationToken cancellationToken = default)
where TDocument : IDocument
where TKey : IEquatable;
///
/// Deletes a document matching the condition of the LINQ expression filter.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// A LINQ expression filter.
/// An optional partition key.
/// An optional cancellation token
/// The number of documents deleted.
long DeleteOne(Expression> filter, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument
where TKey : IEquatable;
///
/// Asynchronously deletes a document matching the condition of the LINQ expression filter.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// The document you want to delete.
/// The cancellation token
/// The number of documents deleted.
Task DeleteOneAsync(TDocument document, CancellationToken cancellationToken)
where TDocument : IDocument
where TKey : IEquatable;
///
/// Asynchronously deletes a document matching the condition of the LINQ expression filter.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// A LINQ expression filter.
/// An optional partition key.
/// The cancellation token
/// The number of documents deleted.
Task DeleteOneAsync(Expression> filter, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument
where TKey : IEquatable;
///
/// Asynchronously deletes the documents matching the condition of the LINQ expression filter.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// A LINQ expression filter.
/// An optional partition key.
/// The cancellation token
/// The number of documents deleted.
Task DeleteManyAsync(Expression> filter, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument
where TKey : IEquatable;
///
/// Asynchronously deletes a list of documents.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// The list of documents to delete.
/// The cancellation token.
/// The number of documents deleted.
Task DeleteManyAsync(IEnumerable documents, CancellationToken cancellationToken)
where TDocument : IDocument
where TKey : IEquatable;
///
/// Deletes a list of documents.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// The list of documents to delete.
/// The number of documents deleted.
long DeleteMany(IEnumerable documents)
where TDocument : IDocument
where TKey : IEquatable;
///
/// Deletes the documents matching the condition of the LINQ expression filter.
///
/// The type representing a Document.
/// The type of the primary key for a Document.
/// A LINQ expression filter.
/// An optional partition key.
/// The number of documents deleted.
long DeleteMany(Expression> filter, string partitionKey = null)
where TDocument : IDocument
where TKey : IEquatable;
}
}