【发布时间】:2021-03-21 18:59:22
【问题描述】:
我在 UI 中呈现数据时遇到问题。使用节点 JS 应用程序和 Mongo DB 是后端。 这是sn-p使用的代码。
employee.get('/results', checkRole(), function (req, res) {
employeeResultModel
.find({})
.then(doc => {
res.send(doc);
})
.catch(err => {
log.error('Error occurred while fetching employee from the database', err);
});
});
mongo 集合员工从db.getCollection('employee').find({}).count() 获得了 8040 条记录
在控制台看到的错误如下,
DataTables warning: table id=executionResult - Ajax error. For more information about this error, please see http://datatables.net/tn/7
也在调试器控制台中
jQuery-3.4.1.min.js:2 GET https://localhost/ci/results?_=1607595446722 500 (Internal Server Error)
加载包含 460 条记录的早期员工集合时,没有发现问题。
我正在寻求帮助,让我知道这个问题是否是由于集合中的大量数据造成的,或者是我的代码存在问题。
员工集合中已提供索引 - “_id”
从调试器的“网络”选项卡中,可以看到作为请求结果获得的 15MB 数据。这是导致此错误的原因吗?
提前致谢。
【问题讨论】: