I have docs which have and array lets call it buckets ad the bucket array holds guid’s for buckets. Not every doc will have all buckets. So how would i get a count list of in how many docs a bucket is present.
Select Count(*), c.`buckets` from Contacts c WHERE _type= "contact" group by c.`buckets`
when i use the basic group by it gives me the count of how often i combo of different buckets are used not how often the bucket item is overall used in buckets array.
If i try to query a list of all buckets and use sub query it doesn’t work either
SELECT text, META().id AS id, ( SELECT RAW COUNT(*) AS Count FROM Contacts c WHERE _type= "contact" AND ANY b IN c.buckets SATISFIES b IN [ d.id ] END) AS Count FROM Contacts d WHERE _type ='bucket'
it complains about key
“msg”: “Error evaluating projection. - cause: FROM in correlated subquery must have USE KEYS clause: FROM Contacts.”