Skip to content

Instantly share code, notes, and snippets.

@LazyFatArrow LazyFatArrow/poll.model.js
Last active May 30, 2019

What would you like to do?
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
You can’t perform that action at this time.