2
votes

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
@PanosK There's no json definition in lb4. You're referring to lb3. - Omar

1 Answers

0
votes

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:

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