开发者社区> 问答> 正文

rockmongo 大文件导入失败? 400 报错

rockmongo 大文件导入失败? 400 报错

 数据库 »  CX_local » 导入

.js file exported with RockMongo:

JS File: 

Either no file input or file is too large to upload.


.js(9兆)导入不进去,有人遇到的回个信。。。

展开
收起
爱吃鱼的程序员 2020-06-01 14:16:42 674 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    修改php.ini中的upload_max_filesize = 32M 或者更大######已经解决了,把php.ini的post上传限制和 max_execution_time = 60     ; Maximum execution time of each script, in seconds
    max_input_time = 360 ; Maximum amount of time each script may spend parsing request data

    memory_limit = 240M      ; Maximum amount of memory a script may consume (8MB)


    这些改大就好了

    ######

    官方提供的有GridFS 解决, https://stackoverflow.com/questions/4667597/understanding-mongodb-bson-document-size-limit

    我看不懂换了种方法。

    文件:./rockmongo/app/controllers/db.php  中 public function doDbImport() { 方法,在第 277行左右 改为

    $ret = array("ok" => 0);
                    if ($format == "js") {
                        $data = explode(";\n", $body);
                        $limit = 10000;
                        $i = 0;
                        $sql  = '';
                        $ys_errmsg = '';
                        foreach ($data as $value) {
                            $sql .= $value.";\n";
                            $i++;
                            if ($i >= $limit) {
                                $ret = $this->_mongo->selectDB($this->db)->execute('function (){ ' . $sql . ' }');
                                if (!$ret["ok"]) {
                                    $this->error = $ret['errmsg'];
                                    break;
                                }
                                $i = 0;
                                $sql = '';
                            }
                        }
                        if ($ret["ok"] && $sql) {
                            $ret = $this->_mongo->selectDB($this->db)->execute('function (){ ' . $sql . ' }');
                        }
                        // $ret = $this->_mongo->selectDB($this->db)->execute('function (){ ' . $body . ' }');

    2020-06-01 14:16:43
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
阿里云数据库案例集下载 立即下载
附件下载测试 立即下载
低代码开发师(初级)实战教程 立即下载