Created
April 5, 2019 03:24
-
-
Save desaijay315/188d860bc00f96dd12ae47d44bb8e47f to your computer and use it in GitHub Desktop.
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 = new mongoose.Schema({ | |
| title:{ | |
| type:String, | |
| unique:true, | |
| required: true, | |
| trim: true | |
| }, | |
| description:{ | |
| type: String, | |
| required:true, | |
| trim: true | |
| }, | |
| author:{ | |
| type: mongoose.Schema.Types.ObjectId, | |
| required:true, | |
| ref:'User' | |
| }, | |
| createdAt:{ | |
| type: Date, | |
| default: Date.now | |
| } | |
| }); | |
| const Post = mongoose.model('Post', PostSchema); | |
| module.exports = Post |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment