OR in Prismic predicate to return documents with two differen types

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!

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

Excellent. Thank you!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.