Skip to content

How do I get posts that have a certain category set to it? #913

Answered by jmikrut
ahmetskilinc asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ahmetskilinc — here's how you'd do that:

const stringifiedQuery = qs.stringify(
  {
    where: {
      'category.name': {
        equals: req.query.name,
      },
    },
  },
  { addQueryPrefix: true }
);

You have to use dot notation to query on nested relationship fields, but this should be golden!

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ahmetskilinc
Comment options

@ahmetskilinc
Comment options

Answer selected by ahmetskilinc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants