I converted my old mysql data into csv, then csv to json. Now I want to insert in my mongodb
here's the json
$json =[
["(2"," 'Kea'"," 'Sand'"," '[email protected]'"," '2013-07-28'"," ''"," '0000-00-00'"," 0)",0];
there are hundreds of these records.
Here's what I've tried
$j=json_decode($json,true);
foreach($j as row){
$todo=array('email'=>$row[4], //email address row
'name'=>$row[2],
);
$collection->insert($todo);
}
In theory I thought it would work but negative. All the other codes of tried have been variations of for each. How can I do this right?