Express JS Tutorial #20 - MongoDB CRUD - Create/Post | Expressjs Tutorial For Beginners

  Рет қаралды 8,507

ARCTutorials

ARCTutorials

Күн бұрын

Пікірлер
@themysteryman-e2j
@themysteryman-e2j 4 жыл бұрын
Thank you very much, bro. Really hats off to your hard work, commitment and patience. Definitely one day your channel will become a great success and learning path for so many enthusiasts like me. Though I'm working as a junior MEAN stack developer, I'm learning a lot about these technologies in depth like architecture and best practices.
@ARCTutorials
@ARCTutorials 4 жыл бұрын
Thank you so much 😀 You made my day buddy!! Thanks for your kind words and encouragement.
@amanuellebassi7294
@amanuellebassi7294 4 жыл бұрын
Thank you so much, Sridhar. It is enlighening!
@ARCTutorials
@ARCTutorials 4 жыл бұрын
Thank you so much buddy
@themysteryman-e2j
@themysteryman-e2j 4 жыл бұрын
A small suggestion, I think It is better to implement a centralized error handling mechanism in node js for a solid architecture design. Please try this may be in later projects or videos.
@ARCTutorials
@ARCTutorials 4 жыл бұрын
hi varaprasad. Yes I will refactor and implement centralized errors in next few tutorials.
@nunavathrajendarrajendar8699
@nunavathrajendarrajendar8699 Жыл бұрын
MongooseError: Model.prototype.save() no longer accepts a callback => please resolve this problem
@awonderingspirit2563
@awonderingspirit2563 Жыл бұрын
I also ran into the same problem? any solution?
@rathangrajpal1463
@rathangrajpal1463 3 жыл бұрын
Hello sir, how can we add data to an existing collection?
@Jerryb821
@Jerryb821 Жыл бұрын
I cannot proceed further as I get errors in create operation. I'm stuck here. help me
@Jerryb821
@Jerryb821 Жыл бұрын
cannot call the save method. looks like save method no longer available
@JUNGELMAN2012
@JUNGELMAN2012 Жыл бұрын
This episode and previous are confusing prior episodes that covered the same topic of connecting to DB with Mongoose. You need to share the end code so we can check.
@crazyfellow1200
@crazyfellow1200 Жыл бұрын
For those who are facing problem with save() use this code newStudent.save(). then(()=>{ res.send(newStudent); }) .catch(err=>{ console.log(err); })
@ARCTutorials
@ARCTutorials Жыл бұрын
Great. Thanks for sharing with community
@sonnysonny66
@sonnysonny66 4 жыл бұрын
perfectly explained sir
@ARCTutorials
@ARCTutorials 4 жыл бұрын
Thanks and welcome
@Jerryb821
@Jerryb821 Жыл бұрын
student.model.js const mongoose = require('mongoose'); var studentSchema = mongoose.Schema({ studentId: Number, firstName: String, lastName: String, age: Number, department: String }); var StudentModel = mongoose.model("Student",studentSchema); module.exports = StudentModel;
@ARCTutorials
@ARCTutorials Жыл бұрын
Hi Buddy. I have recently posted entire series again with Mongoose. U should check it out
@Jerryb821
@Jerryb821 Жыл бұрын
throw new MongooseError('Model.prototype.save() no longer accepts a callback');
@Jerryb821
@Jerryb821 Жыл бұрын
app.js var createError = require('http-errors'); var express = require('express'); var path = require('path'); var cookieParser = require('cookie-parser'); var logger = require('morgan'); var mongoose = require('mongoose'); var indexRouter = require('./routes/index'); var usersRouter = require('./routes/users'); var studentsRouter = require('./routes/students'); mongoose.connect("mongodb://localhost/CRM"); var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(logger('dev')); app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/', indexRouter); app.use('/users', usersRouter); app.use('/students',studentsRouter); // catch 404 and forward to error handler app.use(function(req, res, next) { next(createError(404)); }); // error handler app.use(function(err, req, res, next) { // set locals, only providing error in development res.locals.message = err.message; res.locals.error = req.app.get('env') === 'development' ? err : {}; // render the error page res.status(err.status || 500); res.render('error'); }); module.exports = app;
Fullstack Interview Questions Answers Series by ARCTutorials
3:47
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
013 Building a Very Simple API
14:29
DrEXYNOS
Рет қаралды 1
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН