如何使用php更新多维mongodb记录

I have collection like this

 [_id] => 1
    [user_id] => 2
    [work_details] => Array
        (
            [0] => Array
                (
                    [login_date] => 2015-12-22
                    [login_time] => 16:40:00
                    [log_out_time] => 
                )

        )

while logout I need to update the log_out_time using I tried this but its not working

$user_id = 2;          
$logout_time = date("Y-m-d H:i:s");
$collect = $this->mongo_db->db->selectCollection("log_master");
$new_work = array("log_out_time" =>$logout_time);
$collect->update(array("user_id"=>(int)$user_id,"work_details.login_date"=>'2015-12-22'),array('$push' => array("work_details" =>$logout_time)));

this query will give the following output.

    [_id] => 1
    [user_id] => 2
    [work_details] => Array
        (
            [0] => Array
                (
                    [login_date] => 2015-12-22
                    [login_time] => 16:46:53
                    [log_out_time] => 
                )

            [1] => Array
                (
                    [log_out_time] => 2015-12-22 16:46:58
                )

        )

I need to update the [log_out_time] =>

thank you

You can update specific object with number of that object.

db.log_master.update({
  "user_id":2,
  "work_details.0.login_date":'2015-12-22'
  },
  { 
    $set :{ "work_details.0.log_out_time":"2015-12-22 16:46:58"}
  }
)

In PHP,

$collect->update(
    array(
        "user_id"=>(int)$user_id,
        "work_details.0.login_date"=>'2015-12-22'
    ),
    array(
        '$set' => array("work_details.0.log_out_time" =>$logout_time)
    )
 );