<< Click to display table of contents >> TRVReportFDMongoDataProvider [VCL, FMX] |
A data provider receiving data from MongoDB databases via FireDAC.
Unit RVReportFDMongoDataProvider;
Syntax
TRVReportFDMongoDataProvider = class (TRVReportCustomFDMongoDataProvider)
TObject TPersistent TComponent TRVReportCustomFDMongoDataProvider |
This component provides data for a report generator component from MogoDB databases via FireDAC. FireDAC for MongoDB components are included in RAD Studio since 10 Seattle version.
This data provider handles the following data queries:
•JSON queries containing $match, $sort, $limit, $project, $skip, $database, $collection items
•JSON queries containing only $match part
Examples of data queries:
// complete query syntax
RVReportGenerator1.EscapeDataQuery(
'[{"$match":
{"cuisine": "Italian", "address.zipcode": "10075"}},
{"$limit":"10"}]')
// $match query syntax
RVReportGenerator1.EscapeDataQuery(
'{"cuisine": "Italian", "address.zipcode": "10075"}');
// returning the whole collection:
RVReportGenerator1.EscapeDataQuery('{}')
To use this component, assign it to DataProvider property of TRVReportGenerator.
TRVReportFDMongoDataProvider introduces properties:
property Connection: TFDCustomConnection;
property DatabaseName: String;
property CollectionName: String;
Also: FieldOptions, ObjectView, LocalSQL property.
Database and Collection property specify the default values. They can be overridden by $database and $collection items in a data query.
Internally, the component uses temporal TFDMongoQuery components to handle data queries. The data provider properties and events are assigned to these components. If you want to assign additional properties to them, use OnDataSetCreated event.
In addition to the default query processing, you can provide another DataSet component in OnCreateDataSet event. This DataSet is not necessary needed to be TFDMongoQuery.