Last active
May 30, 2019 00:01
-
-
Save LazyFatArrow/32fe1a7a8e91ffff7758b3e9f6a7e9b6 to your computer and use it in GitHub Desktop.
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
import mongoose, { Schema } from 'mongoose'; | |
const OptionSchema = new Schema({ | |
name: String, | |
votes: { | |
type: Number, | |
default: 0, | |
}, | |
}) | |
const PollSchema = new Schema({ | |
title: String, | |
description: String, | |
options: [OptionSchema], | |
}, { | |
timestamps: true, | |
}); | |
module.exports = mongoose.model('poll', PollSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment