如何使用graphql stripi插件在列表上创建子查询?

时间:2019-04-23 13:44:18

标签: graphql strapi

我正在使用Strapi GraphQl插件,并且我的查询方法内部有一个列表,我想根据某个值过滤该列表。实际上,我希望提取一个子列表,然后从子列表中获取主要查询。

query{
        categories(sort: "name:asc",
          where:{
            technologies:{
              id:{gt:5}
            }
          }) {
          name
          description
          technologies {
            name
            description
            obsolete
          }
        }
      }

技术是技术列表。

我也尝试过类似的事情:

   query{
            categories(sort: "name:asc") {
              name
              description
              technologies(
                 where:{
                  id:{gt:5}
                }) {
                name
                description
                obsolete
              }
            }
          }

OR

   query{
            categories(sort: "name:asc") {
              name
              description
              technologies(
                 where:{
                  id_gt:5
                }) {
                name
                description
                obsolete
              }
            }
          }

但没有任何作用。

我期望的是,我只会得到ID大于5的具有关联技术的类别,因此请过滤ID大于5的技术,然后将其用作我的实际类别列表的where子句。

映射是一个整体,即1个类别可以使用多种技术。

0 个答案:

没有答案
相关问题