1

All,

I have the following schema.

const FeedSchema = new SimpleSchema({
  userId:  {
    type: String,
  },
  date: {
    type: Date,
  },
  summary: {
    type: String,
  },
  text: {
    type: String,
    optional: true,
  }
});


MyCollection.attachSchema(new SimpleSchema() {
  feed: {
    type: Array,
    defaultValue: [],
    label: 'Feed',
  },
 'feed.$': {
    type: FeedSchema,
  },
  fooIds: {
    type: Array,
    defaultValue: [],
    label: 'Foos',
  },
  'fooIds.$': {
    type: String,
  },
});

When I try to $addToSet on the fooIds, I get the following error message.

MyCollection.update({ _id: id }, {
  $addToSet: {
    fooIds: '{the-id-of-a-single-item}'
  }
});

update failed: Access denied. Operator $setOnInsert not allowed in a restricted collection.

However, if I comment out the feed fields... it works. I cannot for the life of me figure out why they would be connected.

Thoughts?

Dan Grahn
  • 9,044
  • 4
  • 37
  • 74

0 Answers0