0
Model
    const AvaliacaoShema = new Schema({
    responsavel: {
        type: String,
        required: true
    },
    time: {
        type: Schema.Types.ObjectId,
        ref: 'Time',
        required: true
    },
    pergunta: [{
        type: Schema.Types.ObjectId,
        ref: 'Pergunta',
        required: true,
    }],
    Resposta: [{
        type: Schema.Types.ObjectId,
        ref: 'Resposta',
        required: true
    }],    
}, {
    timestamps: true
})
module.exports = model('Avaliacao', AvaliacaoShema)
const Avaliacao = require('../models/Avaliacao')
Controller
module.exports = {
    async index(req, res) {
        await Avaliacao.find(req.body)
            .populate('pergunta')
            .populate('getResposta')
            .exec()
            .then((a) => res.json(a))
            .catch(err => console.log(err))
    },
    async show(req, res) {
        await Avaliacao.findById(req.params.id)
            .populate('pergunta')
            .populate('getResposta')
            .exec()
            .then((a) => res.json(a))
            .catch(err => console.log(err))
    },
    async create(req, res) {
        try {
            const avali = await Avaliacao.create(req.body)
            return res.json(avali)
        } catch (error) {
            res.status(500).send({ error })
        }
    },
    async edit(req, res) {
        const avali = await Avaliacao.findByIdAndUpdate(req.params.id, req.body, { new: true, runValidators: true })
        return res.json(avali)
    },
    async delete(req, res) {
        await Avaliacao.findByIdAndDelete(req.params.id)
        return res.send()
    }}
Good morning guys, I’m doing a questionnaire system, which the admin adds to the discipline that respectively has questions from her, I have a Collection of questions that contains discipline + questions, I made a answer Collection, which has options like Yes, No and Does Not Apply, in this on screen is the evaluation that has to save question and answer, is saving _id of the question and _id of the answer, but is not linking them, as I do to link the question with the answer, because in the end I need to make a calculation,
Thanks.