Skip to content

Instantly share code, notes, and snippets.

@donjosef
Created September 24, 2019 19:09
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 donjosef/f98dad2e7844c5bbf3250643f0e0979a to your computer and use it in GitHub Desktop.
Save donjosef/f98dad2e7844c5bbf3250643f0e0979a to your computer and use it in GitHub Desktop.
Create our Post monogoose model
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const postSchema = new Schema({
title: {
type: String,
required: true
},
content: {
type: String,
required: true
},
creator: {
type: Object,
required: true
}
}, {timestamps: true});
module.exports = mongoose.model('Post', postSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment