Collection.update() - Retriving the _id from collection to update colletion with new information for all different users

Hey guys. I hope all is well.
I working on this project in which I plan to allow my users to change things like their email and other information which I collect upon account registration and place in a collection.

I have been trying to do so by using collection.update() but it I think the only way to do so is by using some information like the id from the current user logged in to do so. this is what I have tried:

Template.Account.events({
		'click #email-change-btn': function () {
			var newEmail = $('[name=email]').val();
			Data.update({ _id:** this.userId**}, { $set: {email: newEmail}});    			
		}
	});

As well as:

Template.Account.events({
	'click #email-change-btn': function () {
		var newEmail = $('[name=email]').val();
		Data.update({ _id: **Meteor.userId**}, { $set: {email: newEmail}});    			
	}
});

but the change/update does not work. I am guessing its because the IDs do not match(it’s different from) the one created upon registration. I need something that is unique to each user (that’s why I want to use _id)

This one:

I HAVE THIS CODE IN THE CLIENT NOT THE SERVER SIDE. COULD THIS BE THE ISSUE. How would I fix it and make it work? I was desperate and tried ObjectId but no luck. What could I be doing wrong?

How can I fix this (i.e. change the information in the collection) and make it work for every user who decides to change information in the database such as their email.

So overall, all I want to be able to is change/update the information in the Mongo database for every user who wishes to.

Please feel free to ask for more information if needed.

Thank you in advance. I really appreciate it.

The Data collection will have its own _id. It is unique and different from the value of Meteor.userId() which is a unique id in the Meteor.users collection.

There’s nothing wrong in principle with using the user’s _id as the _id in another collection. It’s certainly an easy way to ensure a single reference to both collections.

Have you confirmed that your Data collection has got the correct data in it (including the matching _ids from Users and Data) before the update? Use meteor mongo to check.

Have you removed the insecure package? If so, you will need to ensure that you have appropriately configured publications for Data.

Are you using allow / deny? This is currently considered to be something of an anti-pattern (it’s so easy to get it wrong). You should maybe consider methods as the guide recommends.