I am trying to validate an object using SimpleSchema in Meteor, before inserting it into the database.
The object looks like this, as I print it from the Meteor method that calls the insert:
channels: { '1': [ 'rect4557-6-4-5-7-4-2', 'rect4557-6-4-97-0-7-6-3' ] } }
If I insert it in the database without attaching a schema to it, it works fine. However, when I have it run through SimpleSchema, the field value as outputted from console.log in the custom validation method is an empty object {}. Even if I don't run any validation, an empty object is stored if SimpleSchema is used.
Code to produce the simpleschema value output:
Arch.schema = new SimpleSchema({
channels: {
type: Object,
custom: function validateChannels() {
console.log("this.value:", this.value)
}
});
Architectures.attachSchema(Architectures.schema);
Really, what should I do? Is this a bug in SimpleSchema?