Filter posts by category in nextjs

I am migrating a project from Gatsby to NextJS and I am having an issue with a query

In Gatsby I was able to do this:

query($slug: String!) {
      filter: { category: { elemMatch: { slug: { eq: $slug } } } }
      sort: { fields: date, order: DESC }
    ) {
      edges {
        node {
          date(formatString: "MMM DD, YY")
          contentNode {
            childMarkdownRemark {
              excerpt(truncate: true, pruneLength: 300)
    datoCmsCategory(slug: { eq: $slug }) {

To get all the articles under certain category, but this doesnt seem to be working with next js, it says

"message": "InputObject 'LinksFilter' doesn't accept argument 'elemMatch'",

any idea how to do this? I am trying to list all articles under certain category in pages/categories/[slug].js

Hello @DatoUser

Unfortunately elemMatch is a feature exclusive to gatsby, so you can’t use element match to match a category to the slug on queries without gatsby, only to match it to strings using "eq"
So to filter based on a category you would use
(filter: {category: {eq: "myCategory"}})