我一直在尝试使用Mongoose在MongoDB中更新/添加一些变量一段时间,但我无法找到我遇到的小错误。
有人可以看到我的代码中的错误,它让我发疯了,我现在还没有发现错误,而且我现在处于关键时刻。
module.exports.findAndSubmitAttempt = function(annotationDate, annotationModule, annotationTitle, date, submission, studentID) {
var query = {date:annotationDate,title:annotationTitle,module:annotationModule};
var updating = ClassAssignments.update(query, { $addToSet: {submissions: [ studentID, submission, date ] } }, {upsert:true}, function(err, doc) {
if(err){
console.log("Something went wrong uploading the submission");
}
console.log(doc);//This means everything works perfectly
})
return query;
}