Created
January 20, 2019 19:11
-
-
Save funador/50a5e9ad2974f48cc8d4e86b87132593 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') | |
| mongoose.Promise = global.Promise | |
| const TodoSchema = new mongoose.Schema({ | |
| text: { | |
| type: String, | |
| required: 'please provide some text for your todo' | |
| }, | |
| done: { | |
| type: String, | |
| default: '' | |
| } | |
| }) | |
| TodoSchema.set('toObject', { | |
| virtuals: true, | |
| transform: function(doc, ret) { | |
| delete ret._id; | |
| } | |
| }) | |
| module.exports = mongoose.model('Todo', TodoSchema) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment