//$map为查找条件,找到需要更新的一条数据
$map['lesson_title'] = $_POST['lessontitle_update'];
//这里是需要插入的数据
$vedio_data = array(
'vedio_title' => $_POST['vediotitle_update'],
'vedio_path' => $info['vedio_update']['savepath'] . $info['vedio_update']['savename'],
'update_date'=>time()
);
//查找数据库中是否存在该条数据
$rs=$this->mongo_vedio->where($map)->find();
if($rs){
//存在追加数组字段
$rs=$this->mongo_vedio->where($map)->add($vedio_data);
$rs=$this->mongo_vedio->where($map)->find();
dump($rs);
}
最佳答案
