steve.king
(Steve King)
1
Hello. I need to pull two different document types in the same query (preferably). For example:
this.$prismic.api.query([
this.$prismic.predicates.at('document.type', 'file-based-task'),
this.$prismic.predicates.at('document.type', 'form-based-task')]).then((response)=>{...})
However, this is returning nothing, i.e.,
I've tried querying them separately and merging the results using Object.assign, spread operator, etc., to no avail. What's the solution?
Thanks in advance!
Fares
3
Hi @steve.king
Welcome to the Prismic community.
You certainly can query to custom types in the same query and here is the query you need to pass:
q=[[any(document.type,["article","blog_post"])]]
And I highly recommend you test your query in the REST API browser before writing your code.
To learn more you can check this article.
Please let me know if you have any further inquires,
Fares
system
(system)
closed as resolved, flag & select 'Something Else' to reopen.
5
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.