I have the following schema
@purchaseOrders = new Meteor.Collection('purchaseOrders');
Schemas.purchaseOrders = new SimpleSchema
message:
type: String
label: "Extra message or instructions"
optional: true
autoform:
afFieldInput:
type: "textarea"
rows: 4
purchaseStatus:
type: String
optional: true
ordersList:
type: String
optional: true
createdAt:
type: Date
autoValue: ->
if this.isInsert
new Date()
updatedAt:
type:Date
optional:true
autoValue: ->
if this.isUpdate
new Date()
owner:
type: String
regEx: SimpleSchema.RegEx.Id
autoValue: ->
if this.isInsert
Meteor.userId()
autoform:
options: ->
_.map Meteor.users.find().fetch(), (user)->
label: user.emails[0].address
value: user._id
purchaseOrders.attachSchema(Schemas.purchaseOrders)
purchaseOrders.helpers
ownersName: ->
user = Meteor.users.findOne(@owner)
if user?.profile?.firstName? and user?.profile?.lastName
user.profile.firstName + ' ' + user.profile.lastName
else
user?.emails?[0].address
isOwner: ->
return this.owner == Meteor.userId()
When i try and insert inside of meteor via the console e.g with purchaseOrder.insert({})
or with any fields, the row is inserted for a moment and then removed.
Also if I specify anything for ordersList
which is a string, I get the error SimpleSchema.clean: filtered out value that would have affected key "ordersList", which is not allowed by the schema
Why?