I'm studying firebase using NoSQL and I had a question while watching this video: Converting SQL Structures to Firebase Structures - Firebase Database for SQL Developers # 2
In it the author creates a structure like this:
Blz...withthisstructureitwouldbeveryeasytoreturnallparticipantsofagiveneventjustbytraversingtheeventAttendeesnode.
ButwhatifIwanttoknowalltheeventsthataparticularuserparticipatesin.HowwouldIdoit?IfIcreateanothernodeusersAttendeesIcoulddothisbysavingtheusersandwithineachusertheeventsthatitparticipates.
Buttherewehaveaproblem:duplicationofdata.Ifthereisamodification,say,ifIremoveaneventfromuserDavid,I'llhavetoremovethetwonodes:eventAttendeesandusersAttendees.
ThiswouldbeeasilydoneusingSQLmodelingasinthephotobutthegoalhereistodousingNoSQL:
So my question is, what is the best way to model this in NoSQL to avoid this kind of problem?
EDIT : I realized that this problem persists for any relation n to n. So by specifying more, my question would be how to do n to n relationships with NoSQL in the best possible way?