Students schema has an array of objects (tests) administered. No two tests are alike, and a student can have multiple tests. Need to be able to insert/update array of [test] objects with different schema's.
Have tried placing each test into it's own Collection tying back to the Student Id, but there are hundreds of unique tests resulting in hundreds of collections. Best practice?
const StudentSchema = new SimpleSchema({
lname: {
type: String,
optional: false,
label: "Last Name",
max: 100
},
fname: {
type: String,
optional: false,
label: "First Name",
max: 100
},
tests: {
type: Object,
blackbox: true,
optional: true,
},
}, { tracker: Tracker });
//Tests Schema example 1------------------------
TestADT_Schema = new SimpleSchema({
total_ADT_score_rs: {type: Number, optional: true,},
total_ADT_score_tsc: {type: Number, optional: true,},
qualitative_score: {type: Number, optional: true,},
});
Test_ADT_Schema.attachSchema(ADT_Schema);
//Test Schema example 2 --------------------------
TestWJIVCA_Schema = new SimpleSchema({
GenIntellectualAbility_AE: {type: Number, optional: true,},
GenIntellectualAbility_GE: {type: Number, optional: true,},
GenIntellectualAbility_RPI: {type: Number, optional: true,},
GenIntellectualAbility_SS: {type: Number, optional: true,},
GFGC_COMPOSITE_AE: {type: Number, optional: true,},
GFGC_COMPOSITE_GE: {type: Number, optional: true,},
GFGC_COMPOSITE_RPI: {type: Number, optional: true,},
});
TestWJIVCA_Schema.attachSchema(TestsWJIVCASchema);
Each student having 1 to n Tests, needing to nest the Tests into the Student's Collection, but not sure if this can be done?
If tests is an array that contains mysterious objects, you should mark the
testsas an array and it's children as the blackbox object: