“Schéma de modèle de mangouste” Réponses codées

Schéma de modèle de mangouste

let movieSchema = mongoose.Schema({
  Title: {type: String, required: true},
  Description: {type: String, required: true},
  Genre: {
    Name: String,
    Description: String
  },
  Director: {
    Name: String,
    Bio: String
  },
  Actors: [String],
  ImagePath: String,
  Featured: Boolean
});

let userSchema = mongoose.Schema({
  Username: {type: String, required: true},
  Password: {type: String, required: true},
  Email: {type: String, required: true},
  Birthday: Date,
  FavoriteMovies: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Movie' }]
});

let Movie = mongoose.model('Movie', movieSchema);
let User = mongoose.model('User', userSchema);

module.exports.Movie = Movie;
module.exports.User = User;
Quaint Quelea

schéma de mangouste / création d'un modèle

const Blog = mongoose.model('Blog', blogSchema);
  // ready to go!
Itchy Iguana

Réponses similaires à “Schéma de modèle de mangouste”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code