I'm trying to do a multiple choice question app but I can't figure out how I should create the node.js models using MongoDB(mongoose). For now, I have a Question model that I found from another similar question that I adapted to the recent syntax:
const Schema = mongoose.Schema;
import { AnswerOptionSchema } from './answer-option-schema';
const QuestionSchema = new Schema({
question: {
type: String,
minlength: 10,
maxlength: 1000,
},
answerOptions: {
type: [AnswerOptionSchema],
default: undefined,
}
}, {
timestamps: true
});
module.exports = Question = mongoose.model('Question', QuestionSchema);
So I try to understand how to create the other models