Bosch IoT Insights

Data Explorer: Filtering for specific device attributes

Data can be filtered for specific attributes. This example shows how the status attribute of a Thing can be filtered.

For instance, the device contains the device attribute status to indicate whether a setting was enabled or disabled at the time. Adjust the set parameters in the query template as follows:

images/confluence/download/attachments/1298257721/Thing_History_Example1_Device_Config3-version-1-modificationdate-1591620159000-api-v2.png

Add the following code block to the template definition:

To filter for a specific parameter with a certain value, add $match at the end of the query.

{
"$group":{
_id: "$_id",
"MetaData": {$first:"$metaData"},
"Payload": {$first:"$payload"},
"DataModifiedAt": {$first:"$metaData.eventStartTs"},
"HistoryModifiedAt": {$first: "$historyData.snapshots.modified"},
"VersionHistory": {$first:"$historyData"},
"VersionHistoryProperties": {$first:"$historyData.snapshots.features.general.properties"},
<#if attribute??> "${attribute}": {$first: "$historyData.snapshots.features.general.properties.${attribute}"}</#if>
}
},
{
"$match": {
"VersionHistory.snapshots.features.general.properties.status": "${status}"
}
},
{
"$limit": 1000
}