Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating user profile details in meteor not working

Tags:

meteor

How can I edit the user details in users collection in my meteor app.My code is

 Meteor.users.update({_id:this._id}, { $set:{"profile.name":pname}} )

This is working only for the 1st user in the list. How can I do this for all users listed ?

like image 475
I'm nidhin Avatar asked Mar 11 '14 07:03

I'm nidhin


1 Answers

I found that the only way to update a Meteor user was to set the criteria using the _id with the Meteor.userId():

Meteor.users.update( { _id: Meteor.userId() }, { $set: { 'oauth.token': token }} );

I do this on the server side so it will block the client until success/failure from Mongo.

like image 104
occasl Avatar answered Oct 18 '22 00:10

occasl