Search code examples
node.jsstrapi

Adding an attribute to a M-M relation in Strapi


Suppose we have the following models:

  1. student
  2. exam

These two models have a many-to-many relation which normally in Strapi translates into a new separate relation table.

I want to specify the score of a student in a specific test.

Normally in plain SQL, this will mean adding a new column to the relation table that will add the score for each student-exam combination. But I don't know if Strapi has the flexibility to implement this approach.

My question is, Is there any possibility to achieve this using Strapi?


Solution

  • there is multiple approaches possible:

    1. by creating score collection with student and exam relation.
    2. by creating a repeatable component in student, witch has score and exam.

    Second option seems more appropriate since component would be bound to student.