Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update user email address in meteor

I want to update email address in meteor by :

Meteor.users.update(this._id, {$set: {"emails[0].address": "deleted_" + preEmail }});

but instead of updating email array, 0 argument, then address ,it create a new field like emails[0] then address. it is interesting that in one other .js file it works correctly!

like image 842
Mehrnoosh Avatar asked Nov 01 '25 17:11

Mehrnoosh


1 Answers

You were almost there. In you code change "emails[0].address" with emails.0.address . My code is working in Angular 2 meteor. I hope it will work for you also :)

 Meteor.users.update({
        _id: id
     }, 
     {
        $set: {
            'emails.0.address': address,
            "username": username
        }
    });
like image 77
Amit kumar Avatar answered Nov 03 '25 18:11

Amit kumar