Couchbase 如何从同级数组中选择字段?

Couchbase 如何从同级数组中选择字段?,couchbase,n1ql,Couchbase,N1ql,我想从FieldName=Field4的元素中选择值(“值”),其中FieldName=Field2的元素中的值(“值”)为null { "FormName":"Form1", "Id": "ID1", "Module":{ "ModuleType":"Form", "Layout":&

我想从FieldName=Field4的元素中选择值(“值”),其中FieldName=Field2的元素中的值(“值”)为null

{
    "FormName":"Form1",
    "Id": "ID1",
    "Module":{
       "ModuleType":"Form",
       "Layout":"Vertical",
       "ControlList":[
          {
             "ControlType":"Widget",
             "Layout":"Vertical",
             "FieldList":[
                {
                   "FieldType":"TextBox",
                   "FieldName":"Field1",
                   "Value":"field1"
                },
                {
                   "FieldType":"TextBox",
                   "FieldName":"Field2",
                   "Value":null
                },
                {
                   "FieldType":"TextBox",
                   "FieldName":"Field1",
                   "Value":"field3"
                }
             ]
          },
          {
             "ControlType":"Widget",
             "Layout":"Vertical",
             "FieldList":[
                {
                   "row":[
                      {
                         "FieldType":"TextBox",
                         "FieldName":"Field3",
                         "Value":"field3"
                      },
                      {
                         "FieldType":"TextBox",
                         "FieldName":"Field4",
                         "Value":"field4"
                      }
                   ]
                }
             ]
          }
       ]
    }
 }
我了解如何获得正确的数据集:

select
 form.Id
from
 `test` as form
where
 any cl in form.Module.ControlList satisfies 
   any fl in cl.FieldList satisfies fl.FieldName = 'Field2' AND fl.`Value` is null
   end 
 end;
。。。返回:

[
  {
    "Id": "ID1"
  }
]
但是我的select语句应该是什么样的呢

[
  {
    "Value": "field4"
  }
]
使用


返回数组项,但其为空:[{}]
SELECT
 ARRAY_FLATTEN((ARRAY (ARRAY (ARRAY {r.`Value`}
               FOR r IN f.`row`
               WHEN r.FieldName = "Field4"
               END)
        FOR f IN c.FieldList
        END)
 FOR c IN t.Module.ControlList
 END),3)[0].*
FROM `test` AS t
WHERE (ANY cl IN t.Module.ControlList
       SATISFIES (ANY fl IN cl.FieldList
                  SATISFIES fl.FieldName = 'Field2' AND fl.`Value` IS NULL
                  END)
       END);