当在postman 中显示此错误时,我try 在NodeJS和FireStore中使用筛选器获取数据
"Cannot read properties of undefined (reading '_internalPath')"个
我的代码
const getAllWords = async (req, res, next) => {
let categoryName = "fruits"
try {
const word = await firestore.collection('12words');
const data = await word.where({categoryName}).get();
const wordArray = [];
if(data.empty) {
res.status(404).send('No words12 found');
}else {
data.forEach(doc => {
const words = new Word12(
doc.id,
doc.data().name,
doc.data().categoryName,
);
wordArray.push(words);
});
res.send(wordArray);
}
} catch (error) {
res.status(400).send(error.message);
}
}