I have small query where I first need to get list of documentIds from another document and then return documents from whose documentIds are in that list, I am trying the following query but it doesn’t work. Any help around it would be much appreciated.
select * from promotions promo where meta().id IN (
select raw eventIds from promotions where meta().id = ‘3068b1e2-5cb6-458f-bfae-f1b9fe638b11’
)
It worked using ARRAY_FLATTEN, does it incur any performance cost??
select * from promotions promo where meta().id IN
ARRAY_FLATTEN((select raw eventIds from promotions where meta().id = ‘3068b1e2-5cb6-458f-bfae-f1b9fe638b11’),1)
What if I have document structure like below and want to pull documents whose keys are in snapShotId, can you help me with that, something similar to the below suggestion given by you,
SELECT p.*
FROM promotions AS p
USE KEYS ARRAY_FLATTEN((SELECT RAW eventIds
FROM promotions USE KEYS “3068b1e2-5cb6-458f-bfae-f1b9fe638b11”),1)
SELECT p.*
FROM promotions AS p
USE KEYS ARRAY_FLATTEN((SELECT RAW eventIds
FROM promotions WHERE ANY v IN snapShotsMappings SATISFIES v. snapShotId ="eff84cc6-4223-4e6f-840b-aeaa16408890" END ),1)