#Custom query or aggregation to join related collection data in Payload?

2 messages · Page 1 of 1 (latest)

winter moon
#

I'm using payload with next and mongo.
have a look at the attacked config, i have a blogs collection and a authors collection and blogs has a foreign field called authorId related to the authors collection
I want to show the user who's the author when they see the blogs in the table i.e, want to join the author field and add author name/image and other fields in the author collection
i saw the docs for the join field : https://payloadcms.com/docs/fields/join
but it specifically says that With a Join you can edit and view collections having reference to a specific collection document which as far as i understand is ( in my case ) to join the blogs to the author collection?
is there a way to do the opposite?
if not directly can i use a custom endpoint where i have a custom query and configure payload to use that when fetching a collection?

lost beaconBOT