#Populating nested relationships with Local API

9 messages · Page 1 of 1 (latest)

hidden nebula
#

I am trying to overwrite the default populate for a nested relationship.

Hey,

I have a collection posts which has a relationship field called author linked to the collection authors and an author has a relationship field called company linked to the collection companies

I want to overwrite the defaultPopulate for company.
I thought this would do the trick, but it does not work, it keeps using the defaultPopulate settings, am I missing something?

await req.payload.findByID({
    collection: "posts",
    id: postId,
    depth: 10,
    locale: language,
    populate: {
        "companies": {
            name: true,
        },
    },
});

Does populate only work one level down?

supple bronzeBOT
nimble lynx
#

have you tried authors.companies?

hidden nebula
hidden nebula
#

I assume this is just not possible then at the moment? Which feels weird because it doesnt feel like an uncommon use case

autumn knot
hidden nebula
autumn knot
hidden nebula
#

Running into this issue again and again, can someone at least confirm if this is a bug or intended behavior?
Makes it very hard to use the local API for data nested beyond one level deep 😕