So I have two Object Arrays that I need to make one Object Array.
var insertEpisode = [{
"show_id":new ObjectId(req.body.show_id),
"show_b":req.body.show_b,
"season":new Double(req.body.season),
"episode_no": new Double(req.body.episode_no),
"title": req.body.title,
"summary": podsummary,
"description": description,
"explicit":req.body.explicit,
"enclosureurl":filesToEpisode[0].file.enclosureurl,
"enclosurebyts": filesToEpisode[0].file.enclosurebyts,
"duration":new Double(filesToEpisode[0].file.duration),
}];
and if there is a image to go with the episode I have
if(image){
var image = [{"image":"this "}]
const array3 = insertEpisode.concat(image);
}
however that does not work. instead it added prints out like
[{"show_id":"6274a3a881cf417136a8a4ed","show_b":"insiderelationships","season":1,"episode_no":40,"title":"Test Title","summary":"A week ago a friend invited a couple of other couples over for dinner. Eventually, the food (but not the wine) was cleared off the table for what turned out to be some fierce Scrabbling.","description":"<![CDATA[<p>A week ago a friend invited aco</p>]]>","explicit":"false","enclosureurl":"URL TO mp3.mp3","enclosurebyts":"173080","duration":00:01:00},{"image":"this "}]
Instead it should look like
[{"show_id":"6274a3a881cf417136a8a4ed","show_b":"insiderelationships","season":1,"episode_no":40,"title":"Test Title","summary":"A week ago a friend invited a couple of other couples over for dinner. Eventually, the food (but not the wine) was cleared off the table for what turned out to be some fierce Scrabbling.","description":"<![CDATA[<p>A week ago a friend invited aco</p>]]>","explicit":"false","enclosureurl":"URL TO mp3.mp3","enclosurebyts":"173080","duration":00:01:00, "image":"this "}]
You can see the image part is joined into the first array.