Hey there! I'm currently working on an app using Meteor and I need to update my email address. The process involves utilizing the Meteor accounts package.
In my form, I pass an email value into an accountDetails object, which will then be used in a method to update my profile (including my email):
Meteor.users.update({_id: this.userId},
{
$set: {
'emails.$.address': accountsDetail.email
}
});
However, when I try to execute this code, I encounter the following error:
Exception while invoking method 'saveAccountInfo' MongoError: The positional operator did not find the match needed from the query. Unexpanded update: emails.$.address
Below is my user schema for reference:
{
"_id" : "12345",
"emails" : [
{
"address" : "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2f4e4d4c1e1d1c6f48424e4643014c4042">[email protected]</a>",
"verified" : false
}
If anyone can assist me with resolving this issue, I would greatly appreciate it. Thank you in advance!