So I have no idea exactly what to title this. I have been messing around with express and mongoose and following the Mozilla Express tutorial series. I decided to adapt their example to my own idea. I planned to create a Call of Duty weapon build database. One of my schemas would look something like this:
var GunSchema = new Schema({
title: {type: String, required: true, maxLength: 100},
weaponClass: { type: Schema.ObjectId, ref: 'weaponClass', required: true },
optic: {type: String, enum: ['optic1','optic2','optic3']},
magazine: {type: String, enum: ['mag1','mag2','mag3']},
grip: {type: String, enum: ['grip1','grip2','grip3']},
// etc etc
});
That would be for a gun which would be part of a weapon class (another schema) eg. AR, Sniper etc.
I want to know if it is possible to narrow it down based on a specific instance, for example, an AK47 based on this gun schema might only be able to equip optic1 and optic2, magazine1 and 3 etc. Am I going the right direction by including ALL of the possible attachments in the gun schema and trying to narrow it down from there or is there another path I should be taking?
Thanks in advance and any help is appreciated!