inserting value in meteor collection document

Viewed 38

This code is trying to insert some value in a document when the method storeUserinputs is called, but I get error

Error invoking Method 'storeUserInputs': Internal server error [500]

I went through it many times but could not find a problem. What am I doing wrong? Thanks.

storeUserInputs: function (doc) {
    var activeTask = ActiveTaskCol.findOne({}, {fields: {action: 1}, sort: {createdAt: -1}, limit: 1}).action;
    console.log(doc);
    doc.forEach(function (obj) {
        console.log(obj);
        InputsCol.update({action: activeTask, name: obj[name]}, {$set: {value: obj[value]}});
   });
}

The above code console logged the following before throwing error

[ { name: 'plate', value: 'x large' } ]
{ name: 'plate', value: 'x large' }

1 Answers
Related