I am dealing with two collections within a single database – "Neighborhood" and "Restaurants". My goal is to identify the exact neighborhood I am currently in so that when I click on the "back" button located on the restaurant.ejs page, it directs me back to the page associated with that specific neighborhood's id.
Despite my attempts using findById({} ... and findById(id, ..., I have been encountering errors.
Below is my code snippet. Could you assist me in determining what should be added in place of the ??? for a potential resolution?
neighborhood.get('restaurant/:id', (req, res) => {
Restaurant.findById(req.params.id, (err, restaurantInfo) => {
Neighborhood.findById(???, (err, foundNeighborhood) => {
res.render('restaurant.ejs', {
restaurant: restaurantInfo,
neighborhood: foundNeighborhood
})
});
});
});