【问题标题】:How can I query double nested objects in Hyperledger Fabric?如何在 Hyperledger Fabric 中查询双重嵌套对象?
【发布时间】:2019-03-31 02:56:59
【问题描述】:

我在 Fabric 中使用 CouchDb,我有下一个 JSON 文档

{ "id": "invoice1", "sellers": [{ "names": "Clark", "items": [{ "iditem": "item1", "properties": [{ "width": "212cm" }] }] }] }

如何查询宽度属性?

【问题讨论】:

    标签: hyperledger-fabric hyperledger blockchain


    【解决方案1】:

    $elemMatch

    用过类似的东西。

    {
       "selector": {
          "sellers": {
             "$elemMatch": {
                "items": {
                   "$elemMatch": {
                      "properties": {
                         "$elemMatch": {
                            "width": {
                               "$eq": "212cm"
                            }
                         }
                      }
                   }
                }
             }
          }
       }
    }
    

    【讨论】:

    • 不使用$eq还有其他方法吗?
    猜你喜欢
    • 2023-04-06
    • 2013-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-24
    相关资源
    最近更新 更多