using System;
using System.Collections.Generic;
using System.Linq.Expressions;
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.
/// An optional partition key
/// A list containing the names of the indexes on on the concerned collection.
Task> GetIndexesNamesAsync(string partitionKey = null)
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 = null, string partitionKey = null)
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 = null, string partitionKey = null)
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 = null, string partitionKey = null)
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 = null, string partitionKey = null)
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 = null, string partitionKey = null)
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 = null)
where TDocument : IDocument
where TKey : IEquatable;
}
}