Table of Contents

Method EnsureCreated

Namespace
MongoDB.EntityFrameworkCore
Assembly
MongoDB.EntityFrameworkCore.dll

EnsureCreated(DatabaseFacade, MongoDatabaseCreationOptions)

Ensures that the database for the context exists. If it exists, no action is taken. If it does not exist then the MongoDB database is created using the MongoDatabaseCreationOptions to determine what additional actions to take.

public static bool EnsureCreated(this DatabaseFacade databaseFacade, MongoDatabaseCreationOptions options)

Parameters

databaseFacade DatabaseFacade

The DatabaseFacade from the EF Core DbContext.

options MongoDatabaseCreationOptions

An MongoDatabaseCreationOptions object specifying additional actions to be taken.

Returns

bool

true if the database is created, false if it already existed.