This is how a mongojs objects gets updated:
db.books.update(
{ _id: tg._id },
{
$set:
{
comment: "Hello",
},
},
This assumes that there is a property called 'comment'. You can do this also via string. So the set clause looks like this:
$set:
{
'comment': "Hello",
},
My point is: I want to create a dnymaic property, which might be
var type = "external_property"
but when I try to add the property type will be assigned. But type should be read as a string, providing 'external_comment'.
How can I achieve that?