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 (将#修改为@)