使用N1QL从couchbase中的json获取嵌套对象

Mah*_*bas 0 json nosql couchbase sql++

我跟随json作为Couchbase中的一个条目:

{
    "messageType": "TRANS",
    "failCount": 0,
    "workOrderDetailMap": {
        "10873": {
            "requestDate": "20160715151239",
            "id": 10873,
            "responseDate": "20160715151305",
            "responseCode": 0,
            "status": "SUCCESS",
            "resultDocuments": [
                "xyz"
            ]
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我想resultCode通过N1QL查询得到字段:

Select * from myproject where workOrderDetailMap.responseCode = 0;
Run Code Online (Sandbox Code Playgroud)

我得到0结果.

我怎样才能做到这一点 ?

ger*_*dss 7

你需要

select * from myproject where workOrderDetailMap.`10873`.responseCode = 0;
Run Code Online (Sandbox Code Playgroud)

如果你需要忽略10873:

select * from myproject where object_values(workOrderDetailMap)[0].responseCode = 0;
Run Code Online (Sandbox Code Playgroud)