-
Model - Video.jsProject using node.js/Cloning Youtube 2020. 8. 23. 15:26
// Video.js import mongoose from 'mongoose'; const videoSchema = new mongoose.Schema({ title: String, description: String, videoUrl: String, createdAt: String, views: { type: Number, default: 0, }, comments: [ { type: mongoose.Schema.Types.ObjectId, ref: 'Comment', }, ], creator: { type: mongoose.Schema.Types.ObjectId, ref: 'User', }, }); const model = mongoose.model('Video', videoSchema); export default model;
참고 자료
소스 코드
https://github.com/zpskek/wetube-v3/commit/742d86082ce16181b432eaa98d480c6118af2cde
'Project using node.js > Cloning Youtube' 카테고리의 다른 글
socialLogin.pug (0) 2020.08.24 Model - Comment.js (0) 2020.08.23 Model - User.js (0) 2020.08.23 MongoDB와 mongoose (0) 2020.08.23 MVC pattern (0) 2020.08.23