2017-01-27

Meteor - MongoDB update using a computed/dynamic field name

v = "secondPart";
collectionName.update(
{ filterHere: "example" }
, {
$set: {
    [ 'firstPart.' + v + '.thirdPart' ]: "fieldValue"
}
}
);

No comments:

Post a Comment