We have the following scenario:
content type A: UID, title, ...
content type B: UID, title, ...
content type C: UID, title, ...
All the UIDs are used as URL path.
Is there a way or what is the best way to query by UID on multiple documents?
What I would like to achieve is something similar to OR condition A.uid == 'something' OR B.uid == 'something'
Is there a way to search in all content types (still on UID), but exclude some (search in A and B, excluding C)?
I encountered the exact same issue a shot while ago. As far as I understand the document model of prismic doesn’t allow such a query to be written through the normal API because the uid field despite having a unique name is not accesible on the document predicate, it can only be accessed through the custom type name my.type.uid
what I ended up doing is running multiple queries in // against each of the possible document types, merging the results and returning the first non empty result. in javascript it looks like this :
That makes me curious : do you only have flat paths ? As far as I am aware you cannot add a / in a uid field which is why we define a custom path field on all our document types to describe the actual path. It feels like some kind of document tree description is missing from prismic where all the documents are in a flat landscape whereas urls can be nested arbitrarily deep ...