The Schema
//SCHEMA SETUP
var campgroundSchema = new mongoose.Schema({
name: String,
image: String,
description: String
})
var campground = mongoose.model("campground", campgroundSchema)
#The error is where coming from here, don't seem to get the campgrounds diplayed
app.get("/campgrounds/:id", function(req, res){
//find the campground with provided ID
campground.findById(req.params.id, function(err, foundCampground){
if(err){
console.log(err)
} else {
//render show template
res.render("show", {campground: foundCampground})
}
})
})
Error message
** message: 'Cast to ObjectId failed for value " 5e61150b58e80830240ef790" at path "_id" for model "campground"', name: 'CastError', model: Model { campground } }**