find all mongoose
//create model students
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const StudentSchema = new Schema({
name: String,
dob: Date,
mobile: String,
address: String,
});
module.exports = mongoose.model("students", StudentSchema);
const STUDENT = require("../models/Student");
exports.getProducts = (req, res, next) => {
//fetch all student data
STUDENT.find().then((p) => {
res.send(p);
});
};
exports.getProducts = (req, res, next) => {
//fetch all student data
STUDENT.find({},(err,p)=>{
res.send(p);
});
};