I have a type Course in my subgraph Course.
To get all my courses i use this query:
Courses {
_id
title
etc
}
Everything is fine with this
But now I also have another subgraph named progress
In this second subgraph I extended the Course type to add a nested field named totalProgression, which gives me the users progression on a course:
extend type Course {
totalProgression: Int
}
And now I can make my query like this:
Courses {
_id
title
totalProgression
}
This works, but it takes a long time.
That’s because for each course I have to get the totalProgression, and to get totalProgression I have to make a mongo request.
If I want to add another nested fields from other subgraphs (for exemple I want to add the students field in the Course type, students that I will get from the User subgraph) it will take even more time.
Is there a way that I can make these queries faster without having to merge all my subgraphs ? Like a way to make one request to get all the totalProgressions and then putting them in the courses, instead of requesting them one by one ?