[英]How to get all data from firestore to bigquery using extension
[英]Is there a way to get all data from a firestore database using useCollectionData()?
我有一個 React 項目,其中有以下代碼:(使用此react hook for firebase)
const messagesRef = firestore.collection('messages');
const query = messagesRef.orederBy('createdAt').limit(25);
const [messages] = useCollectionData(query, {idField: 'id'});
取而代之的是,我不希望查詢被排序或有限制,有沒有辦法進行“空”查詢以從某個集合中獲取所有數據?
如果您傳遞messagesRef
而不是使用orderBy()
和limit()
的查詢,那么查詢應該獲取集合中的所有文檔,因為 CollectionReference 是 Query 的子類:
const messagesRef = firestore.collection('messages');
const [messages] = useCollectionData(messagesRef, {idField: 'id'});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.