Summary

The BMongoHistoryExport is used to export history records to a Mongo database.
Each record of each targeted history will be exported as a document inside a single time series collection. To decrease the storage size inside the database, it is not possible to export records to non time series collections.
For performance reasons, the metadata is normalized, thus sent into another standard collection.
You can use the BExportChecker to check that this component works correctly.


If you have a component for which you are exporting a history, and the component has dynamic tags - such as those assigned through an attached infoSource -, then there will be a new document created in the metadata collection for each of set of tags attached to the document's record in the history. The id of this document will be the name of the component followed by '+' and then a timestamp in milliseconds. 


For example, I have a component called "Sensor" with the following tags:

{    
    building: siteA,
    room: Geneva
}


I export it through BMongoHistoryExport, which will create the following record in the metadata collection:

{
  "_id": "/myStation/Sensor+1696324872986",
  "historyId": "/myStation/Sensor",
  "historyDisplayName": "Sensor",
  "valueFacets": "units=null,precision=1,min=-inf,max=+inf",
  "building": "siteA",
  "room": "Geneva"
}


If I then change the building and the room in the component's infoSorce, then make a new record in the history and export it, the following document will be created in the mongo db:

{
  "_id": "/myStation/Sensor+193322821234",
  "historyId": "/myStation/Sensor",
  "historyDisplayName": "Sensor",
  "valueFacets": "units=null,precision=1,min=-inf,max=+inf",
  "building": "siteB",
  "room": "Paris"
}


Each of the records in the timeseries collection will point to the right metadata document by referencing its specific id.


Note: if later on you assign to the component a set of tags that has already been used in an existing metadata document, then that document will be used instead of creating a new one.




Implementation

  1. Drag and drop the component from the palette anywhere in the station
  2. Select an existing MongoDbTSConnector in the MongoDbConnector slot.
  3. Select one or more selections.
  4. Trigger the Execute action 

 Properties



  • Status: Export status
  • State: State of the export, can be idle, pending or in progress
  • Enabled: Enable/Disable the component.
  • ExecutionTime: Component firing the export a topic at configured times
  • Last Attempt: Datetime of the last export attempt.
  • Last Success: Datetime of the last successful export.
  • Last Failure: Datetime of the last failed export.

  • Fault Cause: The explanation of a fault cause.
  • MongoDbConnector: Connector which will export the histories.
  • TimeSeriesCollection: Name of the time series collection.
  • MetadataCollection: Name of the metadata collection.
  • Selection: Selection of histories to export
  • BatchSize: Number of records to export by batch
  • BatchDelay: Time (in ms) between two exports
  • LastTimestampMap: Map of all the last exported timestamp for each history

Actions

  • Execute: Exports the histories.