Update meteor.users.profile


#1

Hello,
I’am trying to update the meteors.user.profile
Actualy it looks like this :

email : {}
username : xxx
_id : xxxx
profile : {
a : {},
b{}
}

And i want to add data in profile.a ( {user : xxxxx,date: xxxx} )

I’ve tried this :

Meteor.users.update({_id:userId},{$addToSet:{profile.a:object}});

but i get an error, how can i do this ? :man_facepalming:

Thank’s in advance for your help :sunglasses:


#2

What’s the error you are getting?

And where is the code you have posted running - is it within a method?

It’s possible that minimongo or Meteor does not support the $addToSet operator. Perhaps retry using $set?


#3

$addToSet is for adding items to an array