Skip to content

Instantly share code, notes, and snippets.

@raymag
Created August 8, 2020 20:59
Show Gist options
  • Save raymag/c659f006b03f93e25be4e540e374e74e to your computer and use it in GitHub Desktop.
Save raymag/c659f006b03f93e25be4e540e374e74e to your computer and use it in GitHub Desktop.
API Quiz Question Model with Images
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