MongoDB Update Error


#1

I did a quick reference on the tutorial, and yet I am still getting error when I am trying to remove a document, that already exists in my collection. I am able to create new documents, however I am unable to delete them. It says that I need permission, even though I allowed my collection to have access.

app/public/collection.js

const Pet = new Mongo.Collection('pet');

Pet.allow({
  insert: function() {
    return true;
  },
  update: function() {
    return true;
  },
  remove: function() {
    return true;
  }
});

app/server/publish.js

const Pet = new Mongo.Collection('pet');
Meteor.publish('pet', function() {
   return Pet.find();
}

client/view/pet/petshow.js

Template.edit_delete_form.events({
   'click .delete': function(e) {
   Pet.remove(this._id);   
   e.preventDefault();
   }
});

Any help would be much appreciated.


#2

The Pet.allow definition needs to be on the server


#3

I see, for some strange reason I thought it was located in a shared folder between client and server. I solved the solution by myself, putting them in Meteor.methods.