The value of a $push
operator needs to be the array field you want pushed to, not the parent.
Try this instead:
...
return db.activities.update({
'_id': db.ObjectId(request.body.activity),
'user': request.session.user.id
}, {
$push: {
'tags.primary': tags.primary,
'tags.secondary': tags.secondary
}
});
UPDATE
To do this dynamically you need to do something like this:
...
var push = {};
push['tags.' + request.body.relevance] = request.body.tag;
return db.activities.update({
'_id': db.ObjectId(request.body.activity),
'user': request.session.user.id
}, {
$push: push
});