Answer the question
In order to leave comments, you need to log in
Sorting an array of data into groups/collections?
I have an array of data, let's say this (JSON) :
[
{
name: Apple
},
{
name: Orange
},
{
name: Tomato
}
]
Answer the question
In order to leave comments, you need to log in
without a specific applied task, the question boils down to "which is better - tomatoes or apples?". Each decision has a degree of expediency, for example "it will be requested more often in format A than in format B, so we store format A, if necessary, reshape it into B". How to implement in each case should be decided by the one who will use it in the code, based on common sense.
The collection option is good. Only, since you have databases, you don't need to make passes: just organize the tables and make a SQL query.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question