I am new to MySQL and I wonder how to approach the following proplem. I have an object with:
{
id: number,
names: [string]
}
If I wanted to insert this object, would I have to insert it in a for loop, since arrays should not be stored in one single cell?
for(let i=0; obj.names.length > i; i++){
this.service.postObj({id: obj.id, names: obj.names[i]});
}
Would it be the right way? If so, what if I had to iterate through all properties representing an array? As far as I know now, I would have to do it like above but it is really inefficient. Do I oversee something?
I use the MEAN stack (here MySQL, Express, Angular and Nodejs).