Create a MongoDB Data Source
- Install the MongoDB.Driver NuGet package.
Register data connections in the
application.jsonorWeb.configfile.{ "AllowedHosts": "*", "ConnectionStrings": { "MongoDB (local)": "mongodb://localhost:27017/" } }Important
For security reasons, the Web Dashboard control does not expose connection strings defined in
appsettings.jsonorWeb.config. If the configuration file contains connection strings, the control displays an error. Use a data connection string provider to pass connection parameters securely and prevent data leaks.You can use a predefined provider or implement a custom provider.
using DevExpress.DataAccess.Web; // ... var builder = WebApplication.CreateBuilder(args); IConfiguration? configuration = builder.Configuration; services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => { DashboardConfigurator configurator = new DashboardConfigurator(); configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(configuration)); return configurator; });See the following help topic for more information: ASP.NET Core Security Considerations.
In the Dashboard Data Source Wizard, select MongoDB and click Next.

Specify the data connection and click Next:

Configure queries and click Next.

Select data fields and click Finish.

API
| Page Name | Page ID | Class |
|---|---|---|
| Choose Connection | MongoDBDataSourceWizardPageId.ChooseMongoDBDataConnectionPage | ChooseMongoDBDataConnectionPage |
| Choose Schema | MongoDBDataSourceWizardPageId.ChooseMongoDBSchemaPage | ChooseMongoDBSchemaPage |
| Choose Collections | MongoDBDataSourceWizardPageId.ChooseMongoDBCollectionPage | ChooseMongoDBCollectionPage |
See Also