Add option to populate only an array of IDs for relations (and maybe others)
D
Derrickmehaffy
Summary
At the moment our population logic only allows for you to populate the full data context, what I am suggestion is an option to only populate an array of IDs such like [1, 2, 3, 4, ...]
Why is it needed?
Useful if you don't need the full data payload in a single request and can make multiple other requests to fetch the additional data (like lazy loading)
Suggested solution(s)
Not sure of the best method we should use to only select IDs instead of fields thinking maybe some kind of boolean in a populate object?
JC Martin
How about if the relation name is added to the fields array rather than the populate object it just returns an array of ids.
ІП-22мп Кемарський Микита
Also it applies not to
-to-many relations (having an array of related entities), but
-to-one relations (when there's the only related ID)ІП-22мп Кемарський Микита
+, It will also be very useful for me. However, why can't relations ID(s) be always returned (if populate is not specified)? We have it in database (otherwise how populate will work?).
- It's a performance issue if my app needs ID(s) only and I must perform populate (join) to get it
- It adds extra complexity on client side when working with such entities (because for CREATE / UPDATE we operate with IDs (numbers) and for GET we operate with objects of type { id: string, ... })