using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using MongoDbGenericRepository.Models; namespace MongoDbGenericRepository { /// /// The interface exposing index management functionality for Guid Keyed repositories. /// public interface IBaseMongoRepository_Index : IBaseMongoRepository_Index { /// /// Returns the names of the indexes present on a collection. /// /// The type representing a Document. /// The type of the primary key for a Document. /// A list containing the names of the indexes on on the concerned collection. Task> GetIndexesNamesAsync() where TDocument : IDocument where TKey : IEquatable; /// /// Returns the names of the indexes present on a collection. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The cancellation token /// A list containing the names of the indexes on on the concerned collection. Task> GetIndexesNamesAsync(CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Returns the names of the indexes present on a collection. /// /// The type representing a Document. /// The type of the primary key for a Document. /// An optional partition key /// A list containing the names of the indexes on on the concerned collection. Task> GetIndexesNamesAsync(string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Returns the names of the indexes present on a collection. /// /// The type representing a Document. /// The type of the primary key for a Document. /// An optional partition key /// The cancellation token /// A list containing the names of the indexes on on the concerned collection. Task> GetIndexesNamesAsync(string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The result of the create index operation. Task CreateTextIndexAsync(Expression> field) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The cancellation token /// The result of the create index operation. Task CreateTextIndexAsync(Expression> field, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key /// The result of the create index operation. Task CreateTextIndexAsync(Expression> field, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key /// The cancellation token /// The result of the create index operation. Task CreateTextIndexAsync(Expression> field, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The result of the create index operation. Task CreateTextIndexAsync(Expression> field, IndexCreationOptions indexCreationOptions) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The cancellation token /// The result of the create index operation. Task CreateTextIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The result of the create index operation. Task CreateTextIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Create a text index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateTextIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The result of the create index operation. Task CreateAscendingIndexAsync(Expression> field) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The cancellation token. /// The result of the create index operation. Task CreateAscendingIndexAsync(Expression> field, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The result of the create index operation. Task CreateAscendingIndexAsync(Expression> field, IndexCreationOptions indexCreationOptions) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The cancellation token. /// The result of the create index operation. Task CreateAscendingIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key. /// The result of the create index operation. Task CreateAscendingIndexAsync(Expression> field, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateAscendingIndexAsync( Expression> field, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The result of the create index operation. Task CreateAscendingIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in ascending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateAscendingIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The result of the create index operation. Task CreateDescendingIndexAsync(Expression> field) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The cancellation token. /// The result of the create index operation. Task CreateDescendingIndexAsync(Expression> field, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The result of the create index operation. Task CreateDescendingIndexAsync(Expression> field, IndexCreationOptions indexCreationOptions) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The cancellation token. /// The result of the create index operation. Task CreateDescendingIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key. /// The result of the create index operation. Task CreateDescendingIndexAsync(Expression> field, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateDescendingIndexAsync( Expression> field, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The result of the create index operation. Task CreateDescendingIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates an index on the given field in descending order. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateDescendingIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The result of the create index operation. Task CreateHashedIndexAsync(Expression> field) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// The cancellation token. /// The result of the create index operation. Task CreateHashedIndexAsync(Expression> field, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The result of the create index operation. Task CreateHashedIndexAsync(Expression> field, IndexCreationOptions indexCreationOptions) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// The cancellation token. /// The result of the create index operation. Task CreateHashedIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key. /// The result of the create index operation. Task CreateHashedIndexAsync(Expression> field, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateHashedIndexAsync( Expression> field, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The result of the create index operation. Task CreateHashedIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a hashed index on the given field. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The field we want to index. /// Options for creating an index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateHashedIndexAsync( Expression> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// The result of the create index operation. Task CreateCombinedTextIndexAsync(IEnumerable>> fields) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// The cancellation token. /// The result of the create index operation. Task CreateCombinedTextIndexAsync(IEnumerable>> fields, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// Options for creating an index. /// The result of the create index operation. Task CreateCombinedTextIndexAsync( IEnumerable>> fields, IndexCreationOptions indexCreationOptions) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// Options for creating an index. /// The cancellation token. /// The result of the create index operation. Task CreateCombinedTextIndexAsync( IEnumerable>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// An optional partition key. /// The result of the create index operation. Task CreateCombinedTextIndexAsync(IEnumerable>> fields, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateCombinedTextIndexAsync( IEnumerable>> fields, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// Options for creating an index. /// An optional partition key. /// The result of the create index operation. Task CreateCombinedTextIndexAsync( IEnumerable>> fields, IndexCreationOptions indexCreationOptions, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Creates a combined text index. /// IndexCreationOptions can be supplied to further specify /// how the creation should be done. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The fields we want to index. /// Options for creating an index. /// An optional partition key. /// The cancellation token. /// The result of the create index operation. Task CreateCombinedTextIndexAsync( IEnumerable>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Drops the index given a field name /// /// The type representing a Document. /// The type of the primary key for a Document. /// The name of the index Task DropIndexAsync(string indexName) where TDocument : IDocument where TKey : IEquatable; /// /// Drops the index given a field name /// /// The type representing a Document. /// The type of the primary key for a Document. /// The name of the index /// The cancellation token Task DropIndexAsync(string indexName, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; /// /// Drops the index given a field name /// /// The type representing a Document. /// The type of the primary key for a Document. /// The name of the index /// An optional partition key Task DropIndexAsync(string indexName, string partitionKey) where TDocument : IDocument where TKey : IEquatable; /// /// Drops the index given a field name /// /// The type representing a Document. /// The type of the primary key for a Document. /// The name of the index /// An optional partition key /// The cancellation token Task DropIndexAsync(string indexName, string partitionKey, CancellationToken cancellationToken) where TDocument : IDocument where TKey : IEquatable; } }