admin管理员组文章数量:1333406
I have the following collections: Movies
and Actors
.
I just want to call client.getItems('Movies')
and get the data of all movies
with the linked actors
data per item also. It seems to me I can only do that, if I call another client.getItems
with the specific ID of the actor:
client.getItems(
'actors',
{
filters: {
movie: {
movie_id: 5
}
}
}
)
Is there no other way?
I have the following collections: Movies
and Actors
.
I just want to call client.getItems('Movies')
and get the data of all movies
with the linked actors
data per item also. It seems to me I can only do that, if I call another client.getItems
with the specific ID of the actor:
client.getItems(
'actors',
{
filters: {
movie: {
movie_id: 5
}
}
}
)
Is there no other way?
Share Improve this question asked Mar 31, 2020 at 15:43 roNn23roNn23 1,6621 gold badge18 silver badges32 bronze badges1 Answer
Reset to default 9After chatting with the awesome folks of Directus (https://directus.chat/), I was able to solve my problem. You just have to use a field query: https://docs.directus.io/api/query/fields.html
For example:
client.getItems(
'movies',
{
fields: ['*','actors.*.*']
}
)
This will give you all movies
with all data and all relational actors
.
本文标签: javascriptGet all relationship data in one request with Directus 8 JS SDKStack Overflow
版权声明:本文标题:javascript - Get all relationship data in one request with Directus 8 JS SDK - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742246474a2439853.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论