using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDbGenericRepository.Models; namespace MongoDbGenericRepository { /// /// The IBaseReadOnlyRepository exposes the generic Read Only functionality of the BaseMongoRepository. /// public interface IBaseReadOnlyRepository { /// /// The connection string. /// string ConnectionString { get; } /// /// The database name. /// string DatabaseName { get; } #region Read TKey /// /// Asynchronously returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. Task GetByIdAsync(TKey id) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. /// An optional cancellation Token. Task GetByIdAsync(TKey id, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. /// An optional partition key. Task GetByIdAsync(TKey id, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. /// An optional partition key. /// An optional cancellation Token. Task GetByIdAsync(TKey id, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. TDocument GetById(TKey id) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. /// An optional cancellation token. TDocument GetById(TKey id, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. /// An optional partition key. TDocument GetById(TKey id, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given its id. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The Id of the document you want to get. /// An optional partition key. /// An optional cancellation token. TDocument GetById(TKey id, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. Task GetOneAsync(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. Task GetOneAsync(FilterDefinition condition, FindOptions findOption) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. Task GetOneAsync(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. Task GetOneAsync(FilterDefinition condition, FindOptions findOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation Token. Task GetOneAsync(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional cancellation Token. Task GetOneAsync(FilterDefinition condition, FindOptions findOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. /// An optional cancellation Token. Task GetOneAsync(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. /// An optional cancellation Token. Task GetOneAsync( FilterDefinition condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. TDocument GetOne(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. TDocument GetOne(FilterDefinition condition, FindOptions findOption) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. TDocument GetOne(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. TDocument GetOne(FilterDefinition condition, FindOptions findOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation token. TDocument GetOne(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional cancellation token. TDocument GetOne(FilterDefinition condition, FindOptions findOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. /// An optional cancellation token. TDocument GetOne(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given filter definition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. /// An optional cancellation token. TDocument GetOne( FilterDefinition condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given an expression filter. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. Task GetOneAsync(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given an expression filter. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional cancellation Token. Task GetOneAsync(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given an expression filter. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partition key. Task GetOneAsync(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns one document given an 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. Task GetOneAsync(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given an expression filter. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. TDocument GetOne(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given an expression filter. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional cancellation token. TDocument GetOne(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given an expression filter. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partition key. TDocument GetOne(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns one document given an 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. TDocument GetOne(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a collection cursor. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partition key. IFindFluent GetCursor(Expression> filter, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation Token. Task AnyAsync(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. Task AnyAsync(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. Task AnyAsync(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. Task AnyAsync(FilterDefinition condition, CountOptions countOption) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partition key. Task AnyAsync(FilterDefinition condition, CountOptions countOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. /// An optional cancellation Token. Task AnyAsync(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional cancellation Token. Task AnyAsync(FilterDefinition condition, CountOptions countOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partition key. /// An optional cancellation Token. Task AnyAsync( FilterDefinition condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. bool Any(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. bool Any(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. bool Any(FilterDefinition condition, CountOptions countOption) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partition key. bool Any(FilterDefinition condition, CountOptions countOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation token. bool Any(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. /// An optional cancellation token. bool Any(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional cancellation token. bool Any(FilterDefinition condition, CountOptions countOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partition key. /// An optional cancellation token. bool Any(FilterDefinition condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. Task AnyAsync(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional cancellation Token. Task AnyAsync(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partition key. Task AnyAsync(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// 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. Task AnyAsync(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. bool Any(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional cancellation Token. bool Any(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partition key. bool Any(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns true if any of the document of the collection matches the filter condition. /// /// 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. bool Any(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. Task> GetAllAsync(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. Task> GetAllAsync(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. Task> GetAllAsync(FilterDefinition condition, FindOptions findOption) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. Task> GetAllAsync(FilterDefinition condition, FindOptions findOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation Token. Task> GetAllAsync(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. /// An optional cancellation Token. Task> GetAllAsync(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional cancellation Token. Task> GetAllAsync(FilterDefinition condition, FindOptions findOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. /// An optional cancellation Token. Task> GetAllAsync( FilterDefinition condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. List GetAll(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. List GetAll(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. List GetAll(FilterDefinition condition, FindOptions findOption) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. List GetAll(FilterDefinition condition, FindOptions findOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation Token. List GetAll(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partition key. /// An optional cancellation Token. List GetAll(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional cancellation Token. List GetAll(FilterDefinition condition, FindOptions findOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb filter option. /// An optional partition key. /// An optional cancellation Token. List GetAll( FilterDefinition condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. Task> GetAllAsync(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional cancellation Token. Task> GetAllAsync(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partition key. Task> GetAllAsync(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a list of the documents matching the filter condition. /// /// 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. Task> GetAllAsync(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. List GetAll(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional cancellation token. List GetAll(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partition key. List GetAll(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns a list of the documents matching the filter condition. /// /// 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. List GetAll(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. Task CountAsync(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partitionKey Task CountAsync(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. Task CountAsync(FilterDefinition condition, CountOptions countOption) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partitionKey Task CountAsync(FilterDefinition condition, CountOptions countOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation Token. Task CountAsync(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partitionKey /// An optional cancellation Token. Task CountAsync(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional cancellation Token. Task CountAsync(FilterDefinition condition, CountOptions countOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partitionKey /// An optional cancellation Token. Task CountAsync( FilterDefinition condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. long Count(FilterDefinition condition) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partitionKey long Count(FilterDefinition condition, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. long Count(FilterDefinition condition, CountOptions countOption) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partitionKey long Count(FilterDefinition condition, CountOptions countOption, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional cancellation token. long Count(FilterDefinition condition, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// An optional partitionKey /// An optional cancellation token. long Count(FilterDefinition condition, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional cancellation token. long Count(FilterDefinition condition, CountOptions countOption, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A mongodb filter definition. /// A mongodb counting option. /// An optional partitionKey /// An optional cancellation token. long Count(FilterDefinition condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. Task CountAsync(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional cancellation Token. Task CountAsync(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partitionKey Task CountAsync(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partitionKey /// An optional cancellation Token. Task CountAsync(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. long Count(Expression> filter) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional Cancellation Token. long Count(Expression> filter, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partitionKey long Count(Expression> filter, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Counts how many documents match the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// An optional partitionKey /// An optional Cancellation Token. long Count(Expression> filter, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; #endregion #region Min / Max /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. Task GetByMaxAsync(Expression> filter, Expression> maxValueSelector) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. /// An optional cancellation Token. Task GetByMaxAsync( Expression> filter, Expression> maxValueSelector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. /// An optional partitionKey. Task GetByMaxAsync( Expression> filter, Expression> maxValueSelector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. /// An optional partitionKey. /// An optional cancellation Token. Task GetByMaxAsync( Expression> filter, Expression> maxValueSelector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. TDocument GetByMax(Expression> filter, Expression> orderByDescending) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. /// An optional cancellation token. TDocument GetByMax( Expression> filter, Expression> orderByDescending, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. /// An optional partitionKey. TDocument GetByMax( Expression> filter, Expression> orderByDescending, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector to order by descending. /// An optional partitionKey. /// An optional cancellation token. TDocument GetByMax( Expression> filter, Expression> orderByDescending, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. Task GetByMinAsync(Expression> filter, Expression> minValueSelector) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. /// An optional cancellation Token. Task GetByMinAsync( Expression> filter, Expression> minValueSelector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. /// An optional partitionKey. Task GetByMinAsync( Expression> filter, Expression> minValueSelector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. /// An optional partitionKey. /// An optional cancellation token. Task GetByMinAsync( Expression> filter, Expression> minValueSelector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. TDocument GetByMin(Expression> filter, Expression> minValueSelector) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. /// An optional cancellation token. TDocument GetByMin( Expression> filter, Expression> minValueSelector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. /// An optional partitionKey. TDocument GetByMin(Expression> filter, Expression> minValueSelector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the /// filter. /// /// The document type. /// The type of the primary key. /// A LINQ expression filter. /// A property selector for the minimum value you are looking for. /// An optional partitionKey. /// An optional cancellation token. TDocument GetByMin( Expression> filter, Expression> minValueSelector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector for the maximum value you are looking for. Task GetMaxValueAsync(Expression> filter, Expression> maxValueSelector) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector for the maximum value you are looking for. /// An optional cancellation Token. Task GetMaxValueAsync( Expression> filter, Expression> maxValueSelector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector for the maximum value you are looking for. /// An optional partitionKey. Task GetMaxValueAsync( Expression> filter, Expression> maxValueSelector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector for the maximum value you are looking for. /// An optional partitionKey. /// An optional cancellation token. Task GetMaxValueAsync( Expression> filter, Expression> maxValueSelector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. TValue GetMaxValue(Expression> filter, Expression> maxValueSelector) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional cancellation token. TValue GetMaxValue( Expression> filter, Expression> maxValueSelector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional partitionKey. TValue GetMaxValue( Expression> filter, Expression> maxValueSelector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional partitionKey. /// An optional cancellation token. TValue GetMaxValue( Expression> filter, Expression> maxValueSelector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. Task GetMinValueAsync(Expression> filter, Expression> minValueSelector) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional cancellation Token. Task GetMinValueAsync( Expression> filter, Expression> minValueSelector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional partition key. Task GetMinValueAsync( Expression> filter, Expression> minValueSelector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional partition key. /// An optional cancellation token. Task GetMinValueAsync( Expression> filter, Expression> minValueSelector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. TValue GetMinValue(Expression> filter, Expression> minValueSelector) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional cancellation token. TValue GetMinValue( Expression> filter, Expression> minValueSelector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional partition key. TValue GetMinValue( Expression> filter, Expression> minValueSelector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// /// The document type. /// The type of the primary key. /// The type of the value used to order the query. /// A LINQ expression filter. /// A property selector to order by ascending. /// An optional partition key. /// An optional cancellation token. TValue GetMinValue( Expression> filter, Expression> minValueSelector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; #endregion #region Sum /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. Task SumByAsync(Expression> filter, Expression> selector) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// An optional cancellation Token. Task SumByAsync( Expression> filter, Expression> selector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// The partition key of your document, if any. Task SumByAsync(Expression> filter, Expression> selector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// The partition key of your document, if any. /// An optional cancellation token. Task SumByAsync( Expression> filter, Expression> selector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// The partition key of your document, if any. int SumBy(Expression> filter, Expression> selector, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. Task SumByAsync(Expression> filter, Expression> selector) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// An optional cancellation token. Task SumByAsync( Expression> filter, Expression> selector, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// The partition key of your document, if any. Task SumByAsync(Expression> filter, Expression> selector, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// The partition key of your document, if any. /// An optional cancellation token. Task SumByAsync( Expression> filter, Expression> selector, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Sums the values of a selected field for a given filtered collection of documents. /// /// The type representing a Document. /// The type of the primary key. /// A LINQ expression filter. /// The field you want to sum. /// The partition key of your document, if any. decimal SumBy( Expression> filter, Expression> selector, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable; #endregion Sum #region Project TKey /// /// Asynchronously returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. Task ProjectOneAsync( Expression> filter, Expression> projection) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. /// An optional cancellation Token. Task ProjectOneAsync( Expression> filter, Expression> projection, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. /// An optional partition key. Task ProjectOneAsync( Expression> filter, Expression> projection, string partitionKey) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. /// An optional partition key. /// An optional cancellation token. Task ProjectOneAsync( Expression> filter, Expression> projection, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. TProjection ProjectOne(Expression> filter, Expression> projection) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. /// An optional cancellation token. TProjection ProjectOne( Expression> filter, Expression> projection, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. /// An optional partition key. TProjection ProjectOne( Expression> filter, Expression> projection, string partitionKey) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Returns a projected document matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. /// An optional partition key. /// An optional cancellation token. TProjection ProjectOne( Expression> filter, Expression> projection, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. Task> ProjectManyAsync( Expression> filter, Expression> projection) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. /// An optional cancellation Token. Task> ProjectManyAsync( Expression> filter, Expression> projection, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. /// An optional partition key. Task> ProjectManyAsync( Expression> filter, Expression> projection, string partitionKey) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// A LINQ expression filter. /// The projection expression. /// An optional partition key. /// An optional cancellation token. Task> ProjectManyAsync( Expression> filter, Expression> projection, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. List ProjectMany( Expression> filter, Expression> projection) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. /// An optional cancellation token. List ProjectMany( Expression> filter, Expression> projection, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. /// An optional partition key. List ProjectMany( Expression> filter, Expression> projection, string partitionKey) where TDocument : IDocument where TKey : IEquatable where TProjection : class; /// /// Asynchronously returns a list of projected documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type representing the model you want to project to. /// /// The projection expression. /// An optional partition key. /// An optional cancellation token. List ProjectMany( Expression> filter, Expression> projection, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class; #endregion #region Group By /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// The grouping criteria. /// The projected group result. List GroupBy( Expression> groupingCriteria, Expression, TProjection>> groupProjection) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// The grouping criteria. /// The projected group result. /// An optional cancellation token. List GroupBy( Expression> groupingCriteria, Expression, TProjection>> groupProjection, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// The grouping criteria. /// The projected group result. /// The partition key of your document, if any. List GroupBy( Expression> groupingCriteria, Expression, TProjection>> groupProjection, string partitionKey) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// The grouping criteria. /// The projected group result. /// The partition key of your document, if any. /// An optional cancellation token. List GroupBy( Expression> groupingCriteria, Expression, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// A LINQ expression filter. /// The grouping criteria. /// The projected group result. List GroupBy( Expression> filter, Expression> groupingCriteria, Expression, TProjection>> groupProjection) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// A LINQ expression filter. /// The grouping criteria. /// The projected group result. /// An optional cancellation token. List GroupBy( Expression> filter, Expression> groupingCriteria, Expression, TProjection>> groupProjection, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// A LINQ expression filter. /// The grouping criteria. /// The projected group result. /// The partition key of your document, if any. List GroupBy( Expression> filter, Expression> groupingCriteria, Expression, TProjection>> groupProjection, string partitionKey) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); /// /// Groups filtered a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// /// The type representing a Document. /// The type of the grouping criteria. /// The type of the projected group. /// The type of the primary key. /// A LINQ expression filter. /// The grouping criteria. /// The projected group result. /// The partition key of your document, if any. /// An optional cancellation token. List GroupBy( Expression> filter, Expression> groupingCriteria, Expression, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable where TProjection : class, new(); #endregion Group By #region Pagination /// /// Asynchronously returns a paginated list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// The property selector. /// Order of the sorting. /// The number of documents you want to skip. Default value is 0. /// The number of documents you want to take. Default value is 50. /// An optional partition key. /// An optional cancellation token. Task> GetSortedPaginatedAsync( Expression> filter, Expression> sortSelector, bool ascending = true, int skipNumber = 0, int takeNumber = 50, string partitionKey = null, CancellationToken cancellationToken = default) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously returns a paginated list of the documents matching the filter condition. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A LINQ expression filter. /// The sort definition. /// The number of documents you want to skip. Default value is 0. /// The number of documents you want to take. Default value is 50. /// An optional partition key. /// An optional cancellation Token. Task> GetSortedPaginatedAsync( Expression> filter, SortDefinition sortDefinition, int skipNumber = 0, int takeNumber = 50, string partitionKey = null, CancellationToken cancellationToken = default) where TDocument : IDocument where TKey : IEquatable; #endregion Pagination } }