javascript - TypeError: Cannot read property 'split' of undefined | Schema issue? -
i cannot read property 'split' of undefined when following code:
router.get("/startup/:id", function(req, res) { // uses id in url find id in // database passes data foundstartup startup.findbyid(req.params.id).exec(function(err, foundstartup){ if(err) { console.log(err); } else { var split = foundstartup.aboutstartup.techstack.split(","); res.render("startup/show", {startup :foundstartup, split: split}); } }); });
it used work went , removed '_' schema , therefore everywhere had schema called. have no idea why error pop now. have gone through every file created project , nothing left old references. have spent 2 ish hours on google , stackoverflow looking @ others solutions , none have worked me code started used work.
suggestions on solutions? maybe should add error checking instead of later?
Comments
Post a Comment