I am attempting to add elements into a Collection using Meteor/MongoDB for the first time. However, I am encountering an issue when trying to save a new title.
"Access denied. No allow validators set on restricted collection for method 'insert'. [403]"
Template:
<template name="casuistry">
<div class="create">
<form>
<input type="text" name="title" placeholder="Title">
<button>Add</button>
</form>
</div>
</template>
collections.es6.js
Casuistry = new Mongo.Collection('casuistry')
Casuistry.attachSchema(new SimpleSchema({
title: {type: String},
caseNumber: {type: Number, defaultValue: 0},
htmlContent: {type: String, defaultValue: '[]'},
}))
casuistry.es6.js
Template.casuistry.events({
'submit .create form' (e, t) {
var title = t.val('title')
Casuistry.insert({title}, (err, _id) => {
if (err) {
console.log(err)
return
}
t.val('title', '')
Router.go('casuistry', {_id})
})
return false
}
})