I have this schema where discriminator is defined by the type field.
const FilledSchema = new mongoose.Schema({ template:{ type: mongoose.SchemaTypes.ObjectId