Method CreateIndexAsync
- Namespace
- MongoDB.EntityFrameworkCore
- Assembly
- MongoDB.EntityFrameworkCore.dll
CreateIndexAsync(DatabaseFacade, IIndex, CancellationToken)
Creates an index in MongoDB based on the EF Core IIndex definition. No attempt is made to check that the index does not already exist and can therefore be created. The index may be an Atlas index or a normal MongoDB index.
public static Task CreateIndexAsync(this DatabaseFacade databaseFacade, IIndex index, CancellationToken cancellationToken = default)
Parameters
databaseFacadeDatabaseFacadeThe DatabaseFacade from the EF Core DbContext.
indexIIndexThe IIndex definition.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel this asynchronous request.