import {Mongo} from 'meteor/mongo';
import {SimpleSchema} from 'meteor/aldeed:simple-schema';
export const Client = new Mongo.Collection("client");
// Optional is ture
Schema1 = new SimpleSchema({
name: {
type: String,
label: 'Name',
optional: true,
}
......
});
---------
// Required
Schema2 = new SimpleSchema({
name: {
type: String,
label: 'Name',
}
......
});
// Check setting collection
.....
if(getSetting.optional === true){
Client.attachSchema(Schema1)
}else{
Client.attachSchema(Schema2)
}
Please help me.