$StringJsonVariable = '{"data": {"Parent": { "abc": [{"value": "10","code": "c102"},{"value": "20","code": "c103" }]}}';
$JsonVariable = json_decode($StringJsonVariable,true);
$connection = new MongoClient();
$db = $connection -> dbvalue;
$collection = $db -> collVal;
foreach($JsonVariable['data']['Parent'] as $key => $value[0]){
$val=$value[0];
$collection->update(array('_id'=>"abc"),array('$addToSet' => array('VALUES' => array('$each' =>$val), array('upsert' => true))));}
Tried to use addtoSet Each using above syntax. I want to upsert in
single call.