i write the below code but i have the > TypeError: Cannot read properties of undefined (reading 'data')
the code is
exports.getCustomerBonus = (req, res) => {
let userId = req.params.userId
db
.collection('customer')
.where("userId",'==',userId)
.get()
.then((data) => {
return res.json(data.docs[0].data())
})
.catch(err => {
console.error(err)
return res.status(500).send("Something went wrong...")
})
i can't find the error