Use Multiple Predicates

This page shows how to use two or more predicates in a single query.

Before reading

This page assumes that you're using the Vue.js starter project or that you have setup your project as explained on the Integrating with existing project page.

Example 1

Here's an example that uses two predicates. It shows how to query all of the documents of the custom type "blog_post" with the tag "featured".

Copy
this.$prismic.client.query([
  this.$prismic.Predicates.at('document.type', 'blog_post'),
  this.$prismic.Predicates.at('document.tags', ['featured'])
]).then((response) => {
  // response is the response object, response.results holds the documents
});

Example 2

Here's another example that queries all of the documents of the custom type "employee" excluding those with the tag "manager".

Copy
this.$prismic.client.query([
  this.$prismic.Predicates.at('document.type', 'employee'),
  this.$prismic.Predicates.not('document.tags', ['manager'])
]).then((response) => {
  // response is the response object, response.results holds the documents
});