First off, this isn’t best topic name, so my apologies ahead of time! Here’s the scenario:
I’m using Ember on the front-end and trying to take advantage of being able to asynchronously load resources when needed. In order to do so, I need to return the relationships that are associated with the resource (not a compound document). Because I need those relationships and their IDs, I essentially have to hit the database and retrieve all of the relationships whether I want to only return the relationship or I want to include the relationship data as part of a compound document.
It appears that by default, the spec suggests that all relationships are returned as part of the response. If you wish to include specific resources as part of a compound document, then you may then include
them.
The issue I see is that this can get very inefficient if all relations are loaded by default even if not returned as part of a compound document.
That said, is there a compliant way of excluding specific relationships WITHOUT include
-ing them? For example, I have a customer
model and in addition to a number of other relationships, it has a transactions
relation, which could be thousands of records. I obviously do not want to load that until necessary. How would I load x - 1 relationships?
Has anyone run into a similar issue and if so, how did you solve it?
Thanks!