Bash MongoDB插入失败“;插入文档时出错:新文件分配失败“;

Bash MongoDB插入失败“;插入文档时出错:新文件分配失败“;,bash,mongodb,Bash,Mongodb,我使用bash脚本进行插入: for i in *.json do mongoimport --db testdb --collection test --type json --file $i --jsonArray done 现在我的数据库testdb是5.951GB,终端不断地给我错误信息 插入文档时出错:新文件分配失败 我可以在一个集合中保存多少数据?对我来说,处理这件事的最好方法是什么?我目前有20GB的数据,但我还有40GB的数据要添加 -更新- 以下是我的ulimit状

我使用bash脚本进行插入:

for i in *.json
do 
    mongoimport --db testdb --collection test --type json --file $i --jsonArray
done
现在我的数据库
testdb
是5.951GB,终端不断地给我错误信息

插入文档时出错:新文件分配失败

我可以在一个集合中保存多少数据?对我来说,处理这件事的最好方法是什么?我目前有20GB的数据,但我还有40GB的数据要添加

-更新-

以下是我的ulimit状态:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31681
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31681
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Mongo可以在一个集合中处理数十亿个文档,但最大文档大小为。 创建集合时,可以设置其大小:

db.createCollection( "collection-name", { capped: true, size: 100000 } )

如果您必须在一个集合中插入多个文档,Mongo将提供一个批量api:

我选中了,我所有的文件都少于16m。在插入23G数据后,它开始拒绝并告诉我错误您使用的是UNIX操作系统还是OSX?如果是的话,也许你刚刚更新了我的帖子来显示ulimit的状态。“打开文件”或“最大用户进程”会有问题吗?当数据库为21.9GB时,它看起来会停止插入。您解决了吗?我有同样的错误