Hello!
I am using payload cms for my blog created in next.js. I have a problem downloading the image URL that I upload to AWS S3 in a Rich Text field.
The MongoDb query returns an object that contains the
id
of the image from the
media
table.
Currently, in the
serialize
component I created based on the docs on the frontend side sends a request to the api along with the id of the image, which returns me a
filename
from the media table.
Is there a simpler way to do this, to retrieve the
filename
immediately on the backend when querying to MongoDb?
You can use Payload's local API to get your data out and have relationships and uploads populated by the desired depth you need for your frontend. It sounds like you are maybe querying with mongo/mongoose directly and missing out on a big advantage of working with Payload.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.