Created
August 8, 2020 20:59
-
-
Save raymag/c659f006b03f93e25be4e540e374e74e to your computer and use it in GitHub Desktop.
API Quiz Question Model with Images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose') | |
const QuestionSchema = new mongoose.Schema({ | |
description: String, | |
image: { | |
type: String, | |
required: false | |
}, | |
alternatives: [ | |
{ | |
text: { | |
type: String, | |
required: true | |
}, | |
isCorrect: { | |
type: Boolean, | |
required: true, | |
default: false | |
}, | |
image: { | |
type: String, | |
required: false | |
}, | |
} | |
] | |
}) | |
module.exports = mongoose.model('Question', QuestionSchema) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment