Mongoose with node (Static Data)
const mongoose = require('mongoose');
const main = async() =>{
await mongoose.connect('mongodb://0.0.0.0:27017/Class12');
const studentSchema = new mongoose.Schema({
name:String,
father_name:String
});
const studentModel = mongoose.model('students',studentSchema);
let data = new studentModel({name:"Malti sen",father_name:"Ram"});
let result = await data.save();
console.log(result);
}
main()
Comments
Post a Comment