strapi 过滤填充关系,给个例子
时间: 2024-02-16 20:35:03 浏览: 180
好的,关于 strapi 过滤填充关系的例子,假设有两个模型:Article 和 Author,一个 Article 可以有一个 Author,也可能没有。我们可以使用 strapi 进行填充查询,例如:
```
GET /articles?_populate=author
```
这将返回所有 Article,并且每个 Article 的 author 字段将被填充为对应的 Author 记录。如果我们需要对结果进行过滤,可以使用以下语法:
```
GET /articles?author.name=John
```
这将返回所有 Article,但 author 字段仅包含 name 为 "John" 的 Author 记录。这就是 strapi 过滤填充关系的基本用法。
阅读全文
相关推荐

















