Something went wrong. Try again.
VueTube is a YouTube clone built with nodejs, expressjs & mongodb. This is the RESTful API repository.
Something went wrong. Try again.
558 B · 28 lines
JavaScript
at master
1234567891011121314151617181920212223242526272829const mongoose = require('mongoose')
const Schema = mongoose.Schema
const HistorySchema = new Schema( { searchText: { type: String }, type: { type: String, enum: ['watch', 'search'], required: [true, 'Type is required'] }, userId: { type: mongoose.Schema.ObjectId, ref: 'User', required: [true, 'User id is required'] }, videoId: { type: mongoose.Schema.ObjectId, ref: 'Video' } }, { timestamps: true })
module.exports = mongoose.model('History', HistorySchema)