Created
January 17, 2021 15:53
-
-
Save LuffyAnshul/c7cd4280ed6a61d9265a0532f2d0c58e to your computer and use it in GitHub Desktop.
Post Model Schema using mongoose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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