TJ
04/23/2024, 7:47 PMinventory
collection which has a product_id
field that references an id
in a products
collection, is there a way to formulate a join query that searches products
and returns only the items that are referenced in the inventory
collection?Harpreet Sangar
04/24/2024, 4:34 AMcollection: products
q: query
filter_by: $inventory(id: *)
TJ
04/24/2024, 9:19 AMTJ
04/24/2024, 9:24 AM$inventory(id: *)
and not $inventory(productId: *)
Harpreet Sangar
04/24/2024, 9:43 AMid: *
filter matches all the documents of a collection. No other field has an equivalent mechanism. So with $inventory(id: *)
we do an "inner join" of the product
documents that matched the query and all of the inventory
documents.TJ
04/24/2024, 7:25 PM