通过Azure IoT注册表中的标签值查询时出错

时间:2018-10-17 12:24:07

标签: azure azure-iot-hub

我的设备具有以下标记值:

{
  "deviceId": "test",
  "tags": {
    "group": {
      "name": "beta1"
    }
}

当我查询以下内容时:

SELECT * FROM devices WHERE tags.group.name = 'beta1'

我收到以下错误:

There was an error querying devices: BadRequest:{ "Message": "ErrorCode:ArgumentInvalid;BadRequest", "ExceptionMessage": "Tracking ID:c6985322e3014555bc7bcb4892292394-G:9-TimeStamp:10/17/2018 12:22:07" }.

但是,如果我查询的标签不存在,则不会引发任何错误:

SELECT * FROM devices WHERE tags.foo.bar = 'beta1'

如何查询标签值?

1 个答案:

答案 0 :(得分:0)

似乎我们无法在设备twin中使用对“ group”属性的查询。解决方法是重命名它,例如_group。

我猜这是一个错误。

更新: 该问题已解决:

const list = ({ id, item }) => {
  const isChecked = name => items.some(item => item.name === name);
  let itemClass = cx({
    item: true,      
    selected: isChecked(name),
  });
  return (
    <li className={itemClass}
        onClick={() => click(fullItem)} key={id}>
      <div className={styles.name}>
        {isChecked(name) ?
            (<span><i className={`fa fa-check`}></i>{name}</span>)
            : (<span>{name}</span>)
        }
      </div>
    </li>
  );
}


export const click = item => ({
  type: ADD_ITEM,
  payload: item,
});


import {
  ADD_ITEM,      
} from "../actions";

const initialState = {
  items: [],
}

export default (state = initialState, action) => {
  switch (action.type) {
    case ADD_ITEM:
      return {
        ...state,
        items: [action.payload],
      };  
    default:
      return state;
  }
};

更多详细信息:https://github.com/MicrosoftDocs/azure-docs/issues/17106#issuecomment-433177700