Preview:
const mongoose = require("mongoose");

mongoose.connect("mongodb://127.0.0.1:27017/base").then(() =>{
    console.log("server connectet to mongodb");
}).catch((err) =>{
    console.log(err);
});

const student = new mongoose.Schema({
    name: String,
    class: Number,
    study: Boolean
});

const Student = new mongoose.model("data", student);

const adder = async () =>{
    const detail = await Student.create({
        name: "Alex",
        class: 5,
        study: true
    });

};

adder();
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter