express-api-example/app/models/note.js

18 lines
357 B
JavaScript
Raw Permalink Normal View History

2018-11-13 17:46:44 +00:00
const mongoose = require('mongoose');
2018-11-12 15:26:10 +00:00
2018-11-13 17:46:44 +00:00
const { Schema } = mongoose;
2018-11-12 15:26:10 +00:00
2018-11-13 17:46:44 +00:00
const NoteSchema = new Schema({
title: {
type: String, required: [true, "can't be blank"],
},
text: {
type: String, required: [true, "can't be blank"],
},
2018-11-15 18:26:57 +00:00
user: {
type: Schema.Types.ObjectId, ref: 'User',
},
2018-11-13 17:46:44 +00:00
}, { timestamps: true });
module.exports = NoteSchema;