How to get match data in array B where first match condition for array A the same position in array?

sample data:

{
  "process":[
    {
      "seq":"pA",
      "status":"finished"
    },
    {
    "seq":"pB",
    "status":"pending"    
    },
    {
    "seq":"pC",
    "status":"pending"    
    }  
 ],
 "data":[
   {
     "keyA1":"valueA1",
     "keyA2":"valueA2",
     "keyA3":"valueA3"
   },
   {
     "keyB1":"valueB1",
     "keyB2":"valueB2"
   },
   {
     "keyC1":"valueC1",    
   }  
] 
}

I want to query first match data value for first the process[*].status == “pending”,here I want to get
data[1] that has the same position in array A that first match condition?

   {
     "keyB1":"valueB1",
     "keyB2":"valueB2"
   }

SELECT FIRST data[ARRAY_POSITION(process, v)] FOR v IN process WHEN v.status = "pending" END AS data FROM default;

1 Like

Thank you, the following works when remove SATISFIES

SELECT FIRST data[ARRAY_POSITION(process, v)] FOR v IN process WHEN v.status = "pending" END AS data FROM default;