Friday, 5 May 2017

Nodejs - Express Framework - MongoDB

Please refer below code -

exports.ticketList = function(req, res, next) {
    Ticket.find(function(err, data) {
        if (err) {
            //---- Error Handler ----
            return next(err);
        }
        res.render('ticketListView', { ticketList: data });
    });
}

Here I am trying to fetch data from mongoDB. And I can successfully get the data.

But I just wanted to know under what conditions my code would run into error / failure.



via Rohit Waghela

No comments:

Post a Comment