Skip to content

Instantly share code, notes, and snippets.

@LuffyAnshul
Created January 17, 2021 15:53
Show Gist options
  • Select an option

  • Save LuffyAnshul/c7cd4280ed6a61d9265a0532f2d0c58e to your computer and use it in GitHub Desktop.

Select an option

Save LuffyAnshul/c7cd4280ed6a61d9265a0532f2d0c58e to your computer and use it in GitHub Desktop.
Post Model Schema using mongoose
const mongoose = require('mongoose');
const PostSchema = mongoose.Schema({
userID: {
type: String
},
title: {
type: String,
required: true
},
description: {
type: String,
required: true
},
date: {
type: Date,
default: Date.now
}
});
module.exports = mongoose.model('Posts', PostSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment