Skip to content

Instantly share code, notes, and snippets.

@LazyFatArrow
Last active May 30, 2019 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LazyFatArrow/32fe1a7a8e91ffff7758b3e9f6a7e9b6 to your computer and use it in GitHub Desktop.
Save LazyFatArrow/32fe1a7a8e91ffff7758b3e9f6a7e9b6 to your computer and use it in GitHub Desktop.
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