xtrareports-405584-web-reporting-asp-net-core-reporting-end-user-report-designer-in-asp-net-applications-use-data-sources-and-connections-mongodb-register-connections.md
This document describes how to define MongoDB data connections available in the Web Report Designer. The Data Source Wizard displays these connections when users create new MongoDB data sources.
Important
Install the MongoDB.Driver NuGet package to work with MongoDB in the Data Source Wizard.
The Data Source Wizard allows you to create a new MongoDB data source if a MongoDB data connection provider is registered in the application. You can register a built-in connection provider or implement and register a custom provider:
Built-in connection providerThe provider obtains connections from the application’s configuration file (appsettings.json).Custom connection providerThe provider allows you to create connection strings at runtime and use custom storage to store/load connection strings and credentials.
Follow the steps below to use connection strings from the application configuration file:
Add data connections to the application’s configuration file (appsettings.json).
Register the built-in connection string provider. Call the ReportDesignerConfigurationBuilder.RegisterDataSourceWizardConfigFileMongoDBConnectionStringsProvider method at application startup:
A custom connection provider allows you to manage MongoDB connections accessible to users:
To use a custom MongoDB connection strings provider, follow the steps below:
Implement the IDataSourceWizardMongoDBConnectionStringsProvider interface. The following code snippet shows a sample implementation:
Call the RegisterDataSourceWizardMongoDBConnectionStringsProvider<T>() method at application start to register the custom connection strings provider: