David Paulsson
03/13/2024, 1:01 PM/en-us
then I want to get all the variants that has matching field sku
from the Shopify US
collection.
Currently I set it up so Variants have this field
{
name: "shopify_us",
type: "string",
reference: "Shopify US.sku",
optional: true,
},
and then I can query my Variants collections like
const storeCollection = 'Shopify US';
...
query: {
q: '*',
filter_by: `$${storeCollection}(sku:=${props.sku})`,
per_page: 1,
},
So far so good. But how do I do that filter when I'm not looking for a particular SKU? Say it's q: 'lounge chair'
now I still want to get all documents from Variants
where this shopify_us
field exists. But I don't know the SKU, or I have the SKU as a field on the Variants document, but I don't think I can self-reference from the current document to the filter like `filter_by: `$${storeCollection}(sku:=${self.sku})`` and I don't think that it's possible to query for null or undefined values.
So I must be thinking in paths not suited for this. What would be a better approach?