mongodb - insertMany 下拉 mongodb 服务
问题描述
我有 API,我可以在其中获取数据。我mongoose
用来将它保存到我的本地 MongoDB 中。每次保存时,我都会动态创建新的model
并insertMany
在其上使用:
const data = result.Data;
const newCollectionName = `tab_${name.toLowerCase()}`;
const Schema = new mongoose.Schema({}, { strict: false });
const TAB = mongoose.model(newCollectionName, Schema);
return TAB.collection.drop(() => {
// eslint-disable-next-line
const clearJSONs = Object.values(data)
.filter(x => typeof x === 'object');
return TAB.insertMany(clearJSONs, (err, result2) => {
// console.log(result2);
res.json({ success: true });
});
});
但是……后来,当一切都快完成时,我的猫鼬服务倒下了……而且……我什至不知道该怎么办。
更新。蒙哥日志:
2018-06-17T13:43:09.883+0300 E STORAGE [conn58] WiredTiger error (24) [1529232189:883394][4799:0x7f9fe1d30700], WT_SESSION.create: /var/lib/mongodb/: directory-sync: open: Too many open files
如何解决这个问题?
解决方案
问题ulimits
出在系统上。这个人描述了最好的解决方案
推荐阅读
- django-allauth - 如何将 Google One Tap 登录与 django-allauth 集成?
- reactjs - Firebase,React:如何在客户端显示 http 错误?
- python - 使用函数制作“折叠列表”
- c# - 如何创建带参数的函数以在对象列表中查找特定对象
- javascript - 如何在 Chrome 或 Firefox 中监控或分析 DOM 更新?
- c# - 在 SqlBulkCopy.WriteToServer 异常上查找失败的行并通过省略那些失败的行来重试 SqlBulkCopy
- excel - Excel 数据表示,轴标签非数字
- mysql - 如何在 MySQL 中循环遍历 JSON 数据
- python - 如何为 forms.ChoiceField() 设置默认值?
- c# - 可变结构作为成员变量,用于序列化/JSON 生成中的性能