I am new to Firebase and NoSQL and come from an SQL background. I was wondering what would be the best way to store my data:
There are 4 categories, and within each category, there are 3 sub-categories. For each subcategory, there is a list of around 10-20 questions that I need to be able to select 5 from each time the user requests it (at random).
I was originally thinking of just transferring the SQL design into NoSQL however I'm not sure if this just defeats the purpose of NoSQL
I was wondering if a solution like this would work, by storing a list of the 10-20 questions under each category under the subcategory:
"questions": {
"category_one": {
"subcategory_one": ["question_one", "question_two",...],
"subcategory_two": ["question_one", "question_two",...],
"subcategory_three": ["question_one", "question_two",...],
},
"category_two": {
"subcategory_one": ["question_one", "question_two",...],
"subcategory_two": ["question_one", "question_two",...],
"subcategory_three": ["question_one", "question_two",...],
},
.
.
}
Would storing it this way allow me to efficiently query and retrieve the data I need?
The first way I was thinking is like an SQL database where each question is its own JSON object.
"1": {
"category": "1",
"subcategory": "1",
"question": "...",
},
"2": {
"category": "1",
"subcategory": "1",
"question": "...",
},
(I'd assume this way is worse...?)