【发布时间】:2019-06-27 01:51:57
【问题描述】:
我正在创建一个 node.js 应用程序并实现调度程序应用程序。我正在关注这个演练:https://dhtmlx.com/blog/using-dhtmlxscheduler-with-node-js/
当我导航到 /data 页面时,它说无法读取未定义的属性“长度”。我去了github页面,逐字下载了app.js。
这是 app.js 部分抛出错误:
app.get('/data', function(req, res){
db.event.find().toArray(function(err, data){
//set id property for all records
for (var i = 0; i < data.length; i++)
data[i].id = data[i]._id;
//output response
res.send(data);
});
});
【问题讨论】:
-
data未定义,您检查是否有错误?将console.log(err)放在 for 循环之前会得到什么? -
Error occured with no callback to handle it while calling SkinCollection.insert Error: URL malformed, cannot be parsed -
这是我克隆的 git repo,仍然收到错误无法读取未定义的属性“长度”。 link
标签: javascript node.js mongodb dhtmlx-scheduler