Being a beginner in the world of TypeScript, I am struggling to comprehend the error message and how to resolve it.
This is the snippet of my code:
app.put('/compareSpread' , async (req , res) => {
const { roundedSpreadPercentage , cropId} = req.body
const crop = await CropInfo.find({entity: cropId})
const diseaseSpreadOne = crop.diseaseSpreadOne
})
The error seems to be related to the line "const diseaseSpreadOne = crop.diseaseSpreadOne".
Here is a glimpse of what the database object looks like:
[
{
_id: new ObjectId("6349fbcde56e8b6b9dc94266"),
entity: '64287197',
diseaseName: 'Fungi',
probability: 74.3,
diseaseCause: null,
...
image: 'https://plant.id/media/images/60e642b6cf4145739bde0c0947fcd933.jpg',
plantTrue: 'true',
is_healthy: 'false',
healthyBoolean: false,
dateTime: '2022-10-15',
diseaseSpreadOne: 19.1,
diseaseSpreadTwo: 19.1,
__v: 0
}
]
Even after receiving the above data from the database, I am still grappling with understanding the nature of the error.