Mongo DB is a document database with excellent scalability and flexibility. Both local and cloud instances/clusters are supported. Redakt offers Mongo DB integration through a NuGet package.


The Mongo DB database module is part of the Mongo DB provider package. Install the package with the NuGet package manager or the Package Manager Console.

PM> Install-Package Redakt.Providers.MongoDb

Service registration

Register Mongo DB services in the ConfigureServices() method of your project's Startup.cs file by adding an AddMongoDbDataStore() call to the Redakt builder instance. The order in which services are added to the Redakt builder is not important.

public void ConfigureServices(IServiceCollection services)
    // ... framework and other services here

    var builder = services.AddRedakt();
    builder.AddMongoDbDataStore();  // Optionally pass Action<MongoDbOptions> parameter.
    // ... other Redakt services

Configuration settings

The Mongo DB database module is configured through the appsettings.json file. All configuration settings are required. See the example below.

    "Redakt": {
        "DataStore": {
            "MongoDB": {
                "ConnectionString": "<your mongo db connection string>",
                "Database": "<your mongo db database name>"

Additionally, an Action<MongoDbOptions> configuration delegate may be passed to the AddMongoDbDataStore() call. Configuration set through this delegate takes priority and overrides values in the appsettings.json file.

Connection String

Required. Sets the connection string to the Mongo DB instance/cluster in URI format.


Required. Sets the Mongo DB database name. A Mongo DB database is not automatically created by Redakt, therefore a database has to exist before starting your Redakt application for the first time.