Hello I know this is a simple question but Im having trouble accesing just the email from my object.
This are the console logs that Im trying
router.get('/matchs', async (req, res) => {
const match = await Match.find()
res.json(match)
//1
console.log(match)
//2
console.log(match[1])
//3
console.log(match.Data)
//4
console.log(match[1].Email)
});
This is what they’re returning:
//1
[
{ Data: [ [Object], [Object] ], Total: 2 },
{ Data: [ [Object], [Object] ], Total: 2 }
]
//2
{
Data: [
{
Name: 'Lucas',
Surname: 'Torreira',
Email: '******@gmail.com',
Number: 3154009595,
Date: '2022-04-27',
Time: '03:00',
Place: 'Chapinero'
},
{
Name: 'Antonio',
Surname: 'Martin',
Email: '*****@gmail.com',
Number: 3119996545,
Date: '2022-04-27',
Time: '03:00',
Place: 'Chapinero'
}
],
Total: 2
}
//3
undefined
//4
undefined
I also have tried suttf like match[1].Data?.Email, match[1].Data[1] but my attempts to get further in the object have failed also just in case everything but the email is dumb data.
Thank you for any help