'How to show the value of an foreign key in the frontend?

I want to show the value of injurydiseases in the frontend of Animals

AnimalModel.js

injurydiseases: {
    type: mongoose.Schema.ObjectId,
    ref: 'injurydiseases',
},

AnimalController.js

exports.allAnimals = async (req, res, next) => {
  const animals = await Animals.find().populate("injurydiseases");


  res.status(200).json({
      success: true,
      animals
  })
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source