我正在建立一个固件框架,不幸的是我不得不添加历史传感器值。但对于其他用例,我还需要创建日期和修改日期。
因此,我添加了带有变量“TimeInstant”的属性“元数据”。然后我创建一个实体,为该实体创建一个 Orion-Subscription 并使用我的旧 Sensor-Valses 更新该实体。
我发送到 Orion-Context Broker 以更新属性的 Json 文件如下所示:
{
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2015-02-02T11:35:25.0000Z"
}
},
"type": "Number",
"value": 0.0132361 }
我的 Mongo-DB 中的输出如下:
"_id": {
"id": "urn:ngsi-ld:SensorB-K1200____",
"type": "Sensor",
"servicePath": "/test/servicepath"
},
"attrNames": [
"Sensor_value"
],
"attrs": {
"Sensor_value": {
"value": 0.01632361,
"type": "Number",
"md": {
"TimeInstant": {
"type": "DateTime",
"value": 1422876989
}
},
"mdNames": [
"TimeInstant"
],
"creDate": 1568712813,
"modDate": 1568735930
}
},
"creDate": 1568712813,
"modDate": 1568735930,
"lastCorrelator": "0a129232-d964-11e9-8e5a-0242ac130009" }
但是我的 Crate-DB 只有以下列: entity_id entity_type fiware_servicepath sensor_value time_index
我的订阅文件如下所示:
{
"expires": "2019-12-24T18:00:00",
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"metadata": [
"dateCreated",
"dateModified",
"TimeInstant"
]
},
"subject": {
"entities": [
{
"id": "urn:ngsi-ld:SensorB-K1200____",
"type": "Sensor"
}
]
},
"throttling": 0 }
我尝试更改订阅文件中的“元数据”属性,也尝试重新启动 Crate-DB、ContextBroker 例如。
我希望 CrateDb 显示所有三个值:“dateCreated”、“dateModified”和“TimeInstant”。