Setup Many to Many relation in property database

System Information
  • **Strapi Version Latest 4.2:
  • **Operating System Windows 11:
  • Database SqLite:
  • **Node Version 16:
  • **NPM Version 8:

Thank you to let me inside. I am new to Strapi, but with years of experience in SQL databases, so I hope for some help with my question

I am building a property database where some information like features and amenities is a many to many relations, many houses can have many features/amenities.

In SQL I will create extra relation tables, adding JOINS which I can’t see how to this in Strapi, so I am hoping for some help with this issue.

Have a wonderful day

Kind Regards
Tom

Hey,

in strapi you can create your relations easily within the strapi UI / admin panel. In the background a many to many relation is created like you mentioned - with some mapping tables. What you do in strapi (code) later is a sth like

strapi.db
        .query("api::house.house")
        .findOne({where: {features: id}})

Strapi abstracts this and you never need to know or even create mapping tables / joins.

I hope that answered your question