Sample Doc:
{
“_key”: “b6dce680-7543-4de4-a719-ba97bc025cf50”,
“data”: [
{
“group”: “”,
“id”: 0,
“originalValue”: “10000”,
“required”: true,
“type”: “alphanumeric”,
“value”: “10000”
},
{
“group”: “”,
“id”: 1,
“originalValue”: “Option”,
“required”: true,
“type”: “alphabet”,
“value”: “Option”
},
{
“group”: “”,
“id”: 2,
“originalValue”: “2017-07-01”,
“required”: true,
“type”: “date(MM/dd/yyyy)”,
“value”: “07/01/2017”
},
{
“group”: “”,
“id”: 3,
“originalValue”: “2020-07-01”,
“required”: true,
“type”: “date(MM/dd/yyyy)”,
“value”: “07/01/2020”
},
{
“group”: “”,
“id”: 4,
“originalValue”: “3042”,
“required”: true,
“type”: “int”,
“value”: “3042”
},
{
“group”: “”,
“id”: 5,
“originalValue”: “20.00”,
“required”: true,
“type”: “currency”,
“value”: “$20.00”
},
{
“group”: “”,
“id”: 6,
“originalValue”: “20”,
“required”: true,
“type”: “int”,
“value”: “20”
},
{
“group”: “rsu”,
“id”: 7,
“originalValue”: “1.29”,
“required”: true,
“type”: “percent”,
“value”: “1.29%”
},
{
“group”: “rsu”,
“id”: 8,
“originalValue”: “17.30”,
“required”: true,
“type”: “percent”,
“value”: “17.30%”
},
{
“group”: “rsu”,
“id”: 9,
“originalValue”: “1.10”,
“required”: true,
“type”: “percent”,
“value”: “1.10%”
},
{
“group”: “rsu”,
“id”: 10,
“originalValue”: “3.00”,
“required”: true,
“type”: “double”,
“value”: “3.00”
},
{
“group”: “”,
“id”: 11,
“originalValue”: “6.00”,
“required”: true,
“type”: “percent”,
“value”: “6.00%”
},
{
“group”: “”,
“id”: 12,
“originalValue”: “47.07”,
“required”: true,
“type”: “currency”,
“value”: “$47.07”
},
{
“group”: “”,
“id”: 13,
“originalValue”: “44.24”,
“required”: true,
“type”: “currency”,
“value”: “$44.24”
},
{
“group”: “”,
“id”: 14,
“originalValue”: “415”,
“required”: true,
“type”: “int”,
“value”: “415”
},
{
“group”: “”,
“id”: 15,
“originalValue”: “7.39”,
“required”: true,
“type”: “currency”,
“value”: “$7.39”
},
{
“group”: “”,
“id”: 16,
“originalValue”: “54.41”,
“required”: true,
“type”: “currency”,
“value”: “$54.41”
},
{
“group”: “”,
“id”: 17,
“originalValue”: “47.06882441775697”,
“required”: false,
“type”: “currency”,
“value”: “$47.07”
},
{
“group”: “”,
“id”: 18,
“originalValue”: “-0.0011755822430288276”,
“required”: false,
“type”: “currency”,
“value”: “$0.00”
},
{
“group”: “”,
“id”: 19,
“originalValue”: “44.24469495269155”,
“required”: false,
“type”: “currency”,
“value”: “$44.24”
},
{
“group”: “”,
“id”: 20,
“originalValue”: “0.00469495269155118”,
“required”: false,
“type”: “currency”,
“value”: “$0.00”
},
{
“group”: “”,
“id”: 21,
“originalValue”: “7.387572241188462”,
“required”: false,
“type”: “currency”,
“value”: “$7.39”
},
{
“group”: “”,
“id”: 22,
“originalValue”: “-0.0024277588115380055”,
“required”: false,
“type”: “currency”,
“value”: “$0.00”
},
{
“group”: “”,
“id”: 23,
“originalValue”: “36.857122711503095”,
“required”: false,
“type”: “currency”,
“value”: “$36.86”
},
{
“group”: “”,
“id”: 24,
“originalValue”: “-17.5528772884969”,
“required”: false,
“type”: “currency”,
“value”: “($17.55)”
}
],
“id”: 0,
“issue”: false,
“procedureId”: “b6dce680-7543-4de4-a719-ba97bc025cf5”
}
Query:
SELECT distinct ARRAY s.value
FOR s IN d.data WHEN s.id = 17 END FROM procedurecontent AS d
WHERE procedureId= ‘b6dce680-7543-4de4-a719-ba97bc025cf5’ AND ANY v IN d.data SATISFIES v.id = 17 END
Index:
CREATE INDEX proc_value_idx
ON procedurecontent
((distinct (array (s
.value
) for s
in data
end))) WHERE (procedureId
= “b6dce680-7543-4de4-a719-ba97bc025cf5”)