Meteor Mongo Insert Failed -- Access Denied


The first insert works fine, but the second Gives "Insert Failed: 403 -- Access denied" in the console. Auto subscribe is enabled, and I am on the auth branch. How do I set up my code so that I have a server MongoDB that clients can write to?

People = new Meteor.Collection('people'); 

if (Meteor.is_server) {
People.insert({name: 'Bob'});
if (Meteor.is_client) {
People.insert({name: 'Bob'});
9/22/2017 5:57:57 PM

Because you are working with auth, you must allow or deny clients trying to do inserts, updates, removes, and fetches. To fix this specific issue you must add Collection.allow() to let the client's insert work.

if(Meteor.is_server) {

    'insert': function (userId,doc) {
      /* user and doc checks ,
      return true to allow insert */
      return true; 

2/9/2013 12:49:28 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow