【问题标题】:Is it possible to convert JSON Input while sending data from IOT hub to CosmosDb using Stream Analytics是否可以在使用流分析将数据从 IOT 集线器发送到 CosmosDb 时转换 JSON 输入
【发布时间】:2019-11-21 15:26:57
【问题描述】:

我有 JSON INPUT(物联网集线器)

{
    "time": 1574266369775,
    "latitude": 70.703271,
    "longitude": 25.8445082,
    "accuracy": 23.320999145507812,
    "altitude": 498.8999938964844,
    "id": "abs8d5c2ff74b5a5"
}

并希望将其存储到 cosmosDb 中,位于特定的 key 位置。

{
    "updatedtime": 1574345877283,
    "time": 1574347747884,
    "status": "available",
    "deviceId":"abs8d5c2ff74b5a5",
    "location": {
        "time": 1574266369775,
        "latitude": 70.703271,
        "longitude": 25.8445082,
        "accuracy": 23.320999145507812,
        "altitude": 498.8999938964844,
        "id": "abs8d5c2ff74b5a5"
     }
}

有可能吗?我可以将它存储到第一级,但它可以存储在任何文档的密钥中吗?

【问题讨论】:

    标签: azure-cosmosdb azure-iot-hub azure-stream-analytics


    【解决方案1】:

    流分析与 Azure Cosmos DB 的集成允许您根据给定的文档 ID 列在容器中插入或更新记录。这也称为 Upsert。

    Documentation 还表示它启用了对文档的部分更新,即增量执行添加新属性或替换现有属性。

    我的 2 美分:尝试将输出命名为“位置”,并确保在从 ASA 作业写入 cosmos db 输出时具有相同的文档 ID。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-12
      • 1970-01-01
      • 2021-06-25
      • 2021-11-22
      • 1970-01-01
      • 2019-11-30
      • 1970-01-01
      相关资源
      最近更新 更多