I have json object in MongoDB. I want to add a value to this object, for example in locations -> machines -> sensors. I know the _id for the machine, for the location and for the sensor. What is the most efficient way to do this?.
array(
"_id" => '547f2e4cb54b3a96203c9869',
"name" => Array (
"nl" => "klant1"
),
"locations" => Array (
Array (
"_id" => "1",
"name" => Array (
"nl" => "location1",
),
"machines" => Array (
Array (
"_id" => "1",
"name" => Array (
"nl" => "boot1"
),
"sensors" => Array (
Array (
"_id" => "1",
"log" => Array (
)
),
Array (
"_id" => "2",
"log" => Array (
)
)
)
),
Array (
"_id" => "2",
"name" => Array (
"nl" => "boot2"
),
"sensors" => Array (
Array (
"_id" => "1",
"log" => Array (
)
),
Array (
"_id" => "2",
"log" => Array (
)
)
)
),
Array (
"_id" => "3",
"name" => Array (
"nl" => "boot3"
),
"sensors" => Array (
Array (
"_id" => "1",
"log" => Array (
)
),
Array (
"_id" => "2",
"log" => Array (
)
)
)
)
)
)
)