Upsert is failing

I am new to meteor and am trying to upsert to a mongo database from mini mongo.

I am getting the following message?

update failed: Access denied. Upserts not allowed in a restricted collection.

You are probably doing this on the client. You could specify allow rules ( but a much securer way is to access the db in methods (

Thanks I added a method as you suggested and it worked. I was doing this inside a template. Why did that stop it from working?

The makers of Meteor want to save you from allowing collection access from the client, as it would be easy for your app users to modify your data from the JavaScript console. This is a security restriction.