Created
February 3, 2017 20:34
-
-
Save dimitriipro/a28ba9f4ee3025a9bf7178cc3051b2a5 to your computer and use it in GitHub Desktop.
Dynamically update/set a sub attribute of a Collection in Meteor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Dynamically update/set a sub attribute of a Collection in Meteor | |
var $set = {}; | |
$set['profile.' + fieldname] = name; | |
Meteor.users.update({_id:Meteor.user()._id}, { $set: $set }); | |
/* ECMAScript 6 */ | |
Meteor.users.update( | |
{ _id: Meteor.user()._id }, | |
{ $set: { ['profile.' + fieldname]: name } } | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment