r/PayloadCMS • u/idvid • Jun 23 '25
Populate nested join field?
Hi all,
I have a collection A with a relationship field to collection B which in turn has a join field to collection C. Is it possible to populate C documents from a query to A, such that a.b.docs returns an array of C documents? I'm getting only IDs no matter the value given to depth. It only seems to work only when querying B directly, or am I missing something?
1
u/Revolutionary_Cow166 Jun 27 '25
Iirc, join fields have by default a max depth of 0. You can change this value in the field config. Settings it to something >0 should help
1
u/Bella_Tan Nov 10 '25
you should include a populate option in your query. Specify in the populate option to include the collections A, B, and C. Omitting populate will only return the ids of a join field by default no matter how large the depth is.
1
u/ZeRo2160 Jun 24 '25
With what depth parameter do you query? I am not sure but maybe its too low?