Reputation: 84
Here are the condensed cliffs:
Any ideas what could cause these errors?
Code for "inserResults":
insertResults: function(data, userIP){
if(Results.findOne({"data.id": data.questionId})){
Results.update({"data.id": data.questionId}, {$push: {"data.choices": data.choices[0], "data.ip": userIP, "data.timeTracker": data.timeTracker[0]}, $set: {"data.lastResponse": data.lastResponse}});
} else{
Results.insert({data}, function(error, result){
if(!error){
Results.update({"data.id": data.questionId}, {$push: {"data.ip": userIP}});
}
});
}
}
Upvotes: 0
Views: 25
Reputation: 722
Looks like you are passing an undefined object called 'Results' to the method 'insertResults' which I'm assuming puts them into the database? Have you tried checking the invocations of this method and could you maybe post the method in question?
Upvotes: 1