O'Reilly logo

Hands-On Full Stack Web Development with Aurelia by Erikson Haziz Murrugarra Sifuentes, Diego Jose Arguelles Rojas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the Match schema

Create the match.js file in the src/models folder. Then, add the following code:

const mongoose = require('mongoose')const MatchSchema = new mongoose.Schema({    team_1: {      type: String,              min: 3,      max: 100,      required: true    },   team_2: {      type: String,      min: 3,      max: 100,      required: true    },    score: {      team_1: Number,      team_2: Number    }})  module.exports = mongoose.model('match', MatchSchema)

We have defined three attributes, the first two—team_1 and team_2will store the information of the two teams playing. The score of the match. That's all we need for our model.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required