Search code examples
amazon-s3mlabstrapi

Strapi - Media file URLs doesn't show up in database


I'm working on creating a blog with strapi,

I have a content type blog with some basic input fields and media upload to AWS s3

I've created some blog posts via strapi admin panel and the blogs data displayed perfectly when I access the data with the Strapi API, like this:

localhost:1337/blogs

But when I check my Moongose database hosted on mlab Blogs document doesn't have a link to the Images that I've uploaded

upload_files have their own collection on mlab, I just have to find a way in strapi to link blogs with their respective media files upload

Database and API response

database response API response

Environment : Ubuntu 18.04 Database: Moongose with mlab Node: v10.15.3


Solution

  • In fact the blog <-> image relation use the polymorphic relation type.

    This mean an image can be linked to any type of content type. And the info of the relation is stored in the Image side.

    You will not be able to store the Image data in your Blog content type.