如何根据ID请求接收随机文档?极限(10)

时间:2018-06-26 12:17:04

标签: google-cloud-firestore

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;
    }

0 个答案:

没有答案