using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Threading.Tasks; using MongoDB.Driver; using MongoDB.Driver.Linq; using MongoDbGenericRepository.DataAccess.Base; using MongoDbGenericRepository.Models; namespace MongoDbGenericRepository.DataAccess.Delete { 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. /// The number of documents deleted. long DeleteOne(TDocument document) 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. /// The number of documents deleted. long DeleteOne(Expression> filter, string partitionKey = null) 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 number of documents deleted. Task DeleteOneAsync(TDocument document) 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 number of documents deleted. Task DeleteOneAsync(Expression> filter, string partitionKey = null) 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 number of documents deleted. Task DeleteManyAsync(Expression> filter, string partitionKey = null) 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 number of documents deleted. Task DeleteManyAsync(IEnumerable documents) 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; /// /// Gets a IMongoQueryable for a potentially partitioned document type and a filter. /// /// The document type. /// The type of the primary key. /// The filter definition. /// The collection partition key. /// IMongoQueryable GetQuery(Expression> filter, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable; /// /// Gets a collections for a potentially partitioned document type. /// /// The document type. /// The type of the primary key. /// The document. /// IMongoCollection HandlePartitioned(TDocument document) where TDocument : IDocument where TKey : IEquatable; /// /// Gets a collections for a potentially partitioned document type. /// /// The document type. /// The type of the primary key. /// The collection partition key. /// IMongoCollection HandlePartitioned(string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets a collections for the type TDocument with a partition key. /// /// The document type. /// The type of the primary key. /// The collection partition key. /// IMongoCollection GetCollection(string partitionKey = null) where TDocument : IDocument where TKey : IEquatable; } }