Many to Many relationship - data stored in Firestore

Hi - I’m working on an app idea where i have two models that I need to create many to many relationships between them. Since the app will rely on user genenrated associations between the two models, I am thinking I will store the data in Firestore.

However, I’ve not come across a clear solution for how to structure the relationship in the first place in Swift - I’m using a nested array currently which will not suffice, and I’ve seen junction tables mentioned.

Im interested in what people think is the safest, most scalable way to build the relationship in a future proof way?

Cheers.