Heyja, I want to query for an object inside of a collection that has a specific entry in a list, that than has a relation to another item by id. Currently I have set the query like this:
{{base_url}}/api/products?where[shops.data.id][equals]={myid}
if I use a custom field like title or something else it works fine, but when using the auto generated id field, I receive an error
Query Error
with message
The following path cannot be queried: id
how is that supposed to work?
Answer: you can query by id when you dont define the ID attribute as query field. Instead of querying
where[shops.data.id][equals]={id}
you can query for
where[shops.data][equals]={id}
and it will look up in the id field automatically
Star
Discord
online
Get dedicated engineering support directly from the Payload team.