Eager Loading for Reference Fields

Hi everyone,

I googled for 30 mins to find something about eager loading of reference fields but couldn’t find anything. Here is a sample;

1st Content Model : Address
1st Content Model Fields : Street , City

2nd Content Model : Student
2nd Content Model Fields : Student Name , Address

3rd Content Model : School
3rd Content Model Fields : School Name , Student

Address field is a reference field in Student model and Student field is a reference field in School model. So here is my question: When I fetch all Schools to my API by Node.js, I could get value of schoolName but Student has only entry_id, I can’t see Student details hence I can’t see Address details. This is kinda lazy loading and I have to go to contentful again to ask related Students and Address by ids.

Is there any way to get all details by a single query?

Are you using the contentful.js SDK? It will get the whole tree of content for you automatically.

Also check out our documentation page on Links

Hi Charlie,

Thanks for your answer. Links are resolved with contentful.js but not resolved with contentful-management.js. I am using contentful-management because I get environment from space, however this is not possible with contentful.js. Is there any other solution?