微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Strapi - 按 DynamicZone 查询/过滤

如何解决Strapi - 按 DynamicZone 查询/过滤

我有以下内容类型:

Report content type

我想获得所有包含 subjectInfo.__component = personsubjectInfo.gender = male

的报告

使用 nuxt $strapi 我已经试过了:

const res = await this.$strapi.find('reports',{
  subjectInfo: {
    __component: 'subject.person',gender: 'male'
  }
})

但我得到了:

select `reports`.* from `reports` where `reports`.`type` = 'lost' and `reports`.`subjectInfo` = '[object Object]' and (`reports`.`published_at` is not null) limit 100 - sqlITE_ERROR: no such column: reports.subjectInfo

然后我尝试了:

const res = await this.$strapi.find('reports',[
  ['subjectInfo.__component','subject.person']
])

但它给了我 400 - 模型没有实体 subjectInfo.__component

我像这样切换到 $axios:

const query = qs.stringify({
  _where: {
    subjectInfo: {
      __component: 'subject.person',gender: 'male'
    }
  }
})
const res = await this.$axios.$get(`http://localhost:1337/reports?${query}`)

但我收到了 500 - 内部服务器错误

error Error: select `reports`.* from `reports` where `reports`.`subjectInfo` = {"__component":"subject.person","gender":"male"} and (`reports`.`published_at` is not null) limit 100 - sqlITE_ERROR: no such column: reports.subjectInfo

我做错了什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。