我正在做一个大学项目,我已经阅读了关于我的问题的每一篇文章,但我还没有找到解决方案。也许你可以帮我。
代码如下:
viewerObj.update({_id: currentIDViewerVar} , {minutesWatched: 5},{upsert:true} , function (err,result) {
if (err) throw err;
console.log("Viewer " + userNameVar + " gespeichert");
console.log("minsWatched" +minsWatched);
});
我收到以下错误。我看不出我做错了什么。
events.js:160
throw er; // Unhandled 'error' event
^
TypeError: callback.apply is not a function
at C:\Users\picco\Desktop\TwitchWatcher_v19\TwitchWatcher\node_modules\mongoose\lib\model.js:3388:16
at Query.callback (C:\Users\picco\Desktop\TwitchWatcher_v19\TwitchWatcher\node_modules\mongoose\lib\query.js:2185:9)
at C:\Users\picco\Desktop\TwitchWatcher_v19\TwitchWatcher\node_modules\mongoose\node_modules\kareem\index.js:259:21
at C:\Users\picco\Desktop\TwitchWatcher_v19\TwitchWatcher\node_modules\mongoose\node_modules\kareem\index.js:127:16
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Process finished with exit code 1
先感谢您!
你使用了太多的论点。
改变这个:
viewerObj.update({_id: currentIDViewerVar} , {minutesWatched: 5},{upsert:true} , function (err,result) {
if (err) throw err;
console.log("Viewer " + userNameVar + " gespeichert");
console.log("minsWatched" +minsWatched);
});
to this:
viewerObj.update({_id: currentIDViewerVar, minutesWatched: 5}, {upsert:true}, function (err,result) {
if (err) throw err;
console.log("Viewer " + userNameVar + " gespeichert");
console.log("minsWatched" +minsWatched);
});
请参阅文档:
- http://mongoosejs.com/docs/api.html#document_Document-update http://mongoosejs.com/docs/api.html#document_Document-update
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)