Table of Contents

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

databaseFacade DatabaseFacade

The DatabaseFacade from the EF Core DbContext.

index IIndex

The IIndex definition.

cancellationToken CancellationToken

A CancellationToken that can be used to cancel this asynchronous request.

Returns

Task

A Task to track this async operation.