Skip to content

Instantly share code, notes, and snippets.

@THEozmic
Created January 30, 2019 00:55
Show Gist options
  • Save THEozmic/7630e00bc13c0c0be1c43e5334606039 to your computer and use it in GitHub Desktop.
Save THEozmic/7630e00bc13c0c0be1c43e5334606039 to your computer and use it in GitHub Desktop.
import mongoose from 'mongoose'
// Set Posts Schema
const schema = new mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
username: {
type: String,
required: [true, 'Username field is required'],
},
profile_image: {
type: String,
required: [true, 'Profile Image field is required'],
},
content: {
type: String,
required: [true, 'Content field is required'],
},
}, {
timestamps: true
}),
Posts = mongoose.model('posts', schema)
export default Posts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment