0

I build an app for students and I wanna know how to implement many to many relationship. in my structure, student study many courses , course has many students. so if I want to display all the courses that student study I think to make node called "UserFavouriteCourses" then store as child the user key and his nodes child are all the keys of the courses like that enter image description here

but how to implement the course has many students? or maybe there is any other implementation I can do?

Manspof
  • 598
  • 26
  • 81
  • 173
  • 1
    Did you see https://stackoverflow.com/questions/41527058/many-to-many-relationship-in-firebase or one of related answers that Stack Overflow provides to the right? All of those should give you a solid starting point. – Frank van Puffelen Oct 14 '17 at 17:46
  • Frank, if i want to get all the courses objects of the user so first I take the keys and then iterate of all the courses like firebase.ref().child('courses/course_key#number)? do you have an example? – Manspof Oct 15 '17 at 20:06
  • 1
    Here's one example: https://stackoverflow.com/a/37911054 – Frank van Puffelen Oct 15 '17 at 21:43
  • thanks, if you can see another issue I just asked https://stackoverflow.com/questions/46760609/firebase-structure-college-db – Manspof Oct 15 '17 at 22:30

0 Answers0