Firestore(网络) 帮我写一个基于ID的随机文档请求 enter image description here
我可以在没有整个收藏集的情况下这样做吗?
const questions = [];
const docRef = db.collection('ru').doc(category).collection('questions');
try {
const doc = await docRef.get();
doc.forEach((item) => {
questions.push(item.data());
});
} catch (e) {
throw e;
}