Skip to content

Instantly share code, notes, and snippets.

@pallavtrivedi03
Created January 7, 2019 13:32
Show Gist options
  • Save pallavtrivedi03/ef02be572b507afdb87d6cd80d6b8e02 to your computer and use it in GitHub Desktop.
Save pallavtrivedi03/ef02be572b507afdb87d6cd80d6b8e02 to your computer and use it in GitHub Desktop.
MongoDB model for Movie
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const movieSchema = new Schema({
title: {
type: String,
required: true
},
year: {
type: Number,
required: true
},
released : {
type: String,
required: true
},
genre : {
type: String,
required: true
},
director : {
type: String,
required: true
},
actors : {
type: String,
required: true
},
plot: {
type: String,
required: true
},
poster : {
type: String,
required: true
},
imdbRating : {
type: Number,
required: true
},
language : {
type: String,
required: true
},
runtime : {
type: Number,
required: true
}
});
module.exports = mongoose.model('Movie',movieSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment