Strapi - 按 DynamicZone 查询/过滤

时间:2021-06-13 22:57:42

标签: strapi nuxt-strapi

我有以下内容类型: 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

我做错了什么?

0 个答案:

没有答案