DEV Community

Rittwick Bhabak
Rittwick Bhabak

Posted on

#3 Models and Collection

File: models/marioChar.js

const mongoose = require('mongoose');

const Schema = mongoose.Schema;

const MarioCharSchema = new Schema({
    name: String,
    weight: Number
})

const MarioChar = mongoose.model('mariochar', MarioCharSchema)

module.exports = MarioChar;

// Now we can do the following
// var myChar = new MarioChar({ name: "Rayan", weight: 100 });
Enter fullscreen mode Exit fullscreen mode

Top comments (0)