Table of Contents

Class MongoDBDataProvider

Namespace
combit.Reporting.DataProviders
Assembly
combit.ListLabel31.CrossPlatform.MongoDBDataProvider.dll

Provides a data provider implementation for MongoDB databases.

public sealed class MongoDBDataProvider : IDataProvider, ICanHandleUsedIdentifiers, ISupportsLogger, ISupplyBaseTables
Inheritance
MongoDBDataProvider
Implements
Inherited Members

Examples

The following example demonstrates how to use the MongoDBDataProvider to export a report to PDF:

// Create a MongoDBDataProvider with server address, database name, and credentials.
MongoDBDataProvider provider = new MongoDBDataProvider(
    "localhost", 
    "my_database", 
    "my_username", 
    "my_password", 
    "27017");

// Create a ListLabel reporting engine instance and assign the provider as the data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;

// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;

// Export the report to PDF.
listLabel.Export(exportConfiguration);

Remarks

The MongoDBDataProvider class implements IDataProvider, ICanHandleUsedIdentifiers, ISupportsLogger, and ISupplyBaseTables to enable access to MongoDB collections and documents. It uses the official MongoDB .NET Driver to connect to a MongoDB server and automatically builds table structures from collections, including nested arrays as child tables with appropriate relations. The provider supports filtering, sorting, and count queries.

Constructors

MongoDBDataProvider(string, string, string, string, string)

Constractor of MongoDB data provider for ListLabel

public MongoDBDataProvider(string serverAddress, string databaseName, string username, string password, string port = "27017")

Parameters

serverAddress string

Server address of MongoDB server

databaseName string

Name of the database

username string

Username to connect to the MongoDB server

password string

password to connect to the MongoDB server

port string

Port of the MongoDB server. Default MongoDB port is 27017, so just change it if another port number is explicitly defined in MongoDB server

Fields

Database

public IMongoDatabase Database

Field Value

IMongoDatabase

Properties

Client

public MongoClient Client { get; set; }

Property Value

MongoClient

SupportCount

public bool SupportCount { get; set; }

Property Value

bool

Tables

Gets the collection of tables available in the provider.

public ReadOnlyCollection<ITable> Tables { get; }

Property Value

ReadOnlyCollection<ITable>