When I do this:
return scores.updateQ({_id:score._id},
{
$set:{"partId":partId,"activityId":activityId},
$unset:{topicType:'',topicId:'',courseId:''}
},
{strict:false})
Where partId
and activityId
are variables, defined elsewhere,
I get
{ name: 'MongoError',
message: 'unknown top level operator: $set',
index: 0,
code: 2,
errmsg: 'unknown top level operator: $set' }
This answer says
"The "unknown top level operator" message means that the operator has to appear after the field to which it applies."
But the documentation says you can do it the way I'm doing it
So maybe there's something else wrong?