Maeh Maeh - 1 month ago 7
JSON Question

Firebase data structure: Attending school on date

I am currently looking into my first application using Firebase as the backend.

I have 2 models, School and User. Each user can sign up for a date to attend the school, so I also need a Date.

A SQL table would look like this:

schools: id, name

users: id, name, email

schools_users: id, school_id, user_id, date

What would be the proper way of designing this data structure in Firebase?

Answer Source

Since you don't specify any requirements, I suggest starting with the most naive mapping at first:

        1: "name of school1"
        2: "name of school2"
        1: { "name": "Maeh", "email": "" }
        2: { "name": "Frank", "email": "" }
        1_1: "20141031"
        1_2: "20130102"