loopback 4 hasMany include filter Error 500

纵饮孤独 提交于 2020-03-23 04:14:09

问题


i am doing some practice with loopback 4, following the tutorial todo-list https://loopback.io/doc/en/lb4/todo-list-tutorial.html

i am trying to query data to gel todo-lists and related todos

GET http://127.0.0.1:3000/todo-lists?filter[include]=todos

i get an error 500 : relations "todos" not defined for the model TodoList

The route GET http://localhost:3000/todo-lists/1/todos works properly, but i'd like to retrieve lists and related todos.

I read many posts and the documentation but i do not understand what is wrong.

Thanks


回答1:


Disclaimer: I am a co-author and one of the current maintainers of LoopBack.

LoopBack 4 does not yet support inclusion of related models when querying the database. You can join the discussion in the following GitHub issues:

  • Inclusion of related models #1352
  • Include related models in "GET /mymodels" results #1889

Please consider upvoting those issues by pressing the yellow thumbs-up button at the bottom of issue description.


UPDATE - 2020-03-04

These issues have been updated and now you can implement hasMany relations. Find more info here



来源:https://stackoverflow.com/questions/53162562/loopback-4-hasmany-include-filter-error-500

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!