向mongo数据表中的数组字段追加数组

浏览:1338 发布日期:2016/12/09 分类:求助交流 关键字: mongo 数组字段插入数组
//$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);
                }
最佳答案
评论( 相关
后面还有条评论,点击查看>>