Understanding relations in Strapi
When building an API, we often need to create relations between different entities of the system. Those relations range from simple and trivial relations to more complex ones. Strapi's Relation field allows us to establish a relation between multiple content-types.
Strapi provides us with six different types of relations to work with, as detailed next.
One-way
This relation reads as has one. If we choose this relation when creating a Tutorial content-type, the relation will read as Tutorial has one Classroom, and what will happen under the hood is that Strapi will create a classroom foreign key (FK) field in the Tutorials table in the database. When creating a Tutorial entity, we can associate it with one Classroom entity, and we will have a classroom
object in the API response when we call one of the Tutorial GET
API endpoints. The process is illustrated in the following screenshot: