Relationship to the same Content Type

System Information
  • Strapi Version: 3.6.5
  • Operating System: Ubuntu LTS 20.04
  • Database: Postgres

Is there a way to reference the same content type in a relationship? I have a content type of Dog and these Dogs have a relationship with a Mother and Father which are also dogs. I need to be able to traverse these relationships like a tree, however it doesn’t seem like I can set the content type in a relationship to the same content type. Is there any way around this?

Yes you can set a self-referencing relationship but it largely depends on the type of relationship you are looking to make. I would advise using a “manyWay” (far right on the relation matrix) from one side (most likely parents side).

ManyToMany style relationships are extremely complex and extremely performance destructive and should only be used in extremely rare cases with a high degree of caution.

Thank you! I’ll look into this.

After opening Strapi back up, and i feel silly, I realize the reason that I couldn’t reference the “Dog” content type that I was making in the relationship view was because I hadn’t done the initial save on the Content Type. After it was saved, I can now set up a relationship with the same content type!

1 Like