Reporting for WinForms - Bind a Report to a MongoDB Instance

Create and set up a MongoDBDataSource object to bind a report to a MongoDB instance in code.

  • Specify connection parameters to connect to a MongoDB instance. You can create a MongoDBConnectionParameters class instance and specify connection parameters individually, such as a hostname and port. If you want to use a connection string, you can create a MongoDBCustomConnectionParameters object and assign this string to the object's ConnectionString property. Assign the created connection parameters to the MongoDB data source's ConnectionParameter property.

  • Create queries to retrieve data from database collections of a MongoDB instance. An object of a MongoDBQuery class corresponds to one query. Set the query's DatabaseName and CollectionName properties to the name of a database and collection from which you want to load data. You can also filter the collection's items. For this, assign a filter condition to the query's FilterString property. Add the created queries to the MongoDB data source's Queries collection.

Note

This example uses the following connection string to connect to a MongoDB instance: mongodb://localhost:27017. The example also specifies queries to load data from the collections of the Northwind database. Before you run this example, specify a connection string and data queries to a configured MongoDB instance.

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)