我在firestore的檔案參考中尋找有關firestore中查詢功能的更多詳細資訊,我發現了這個偽語法:
query(query, queryConstraints)
但是在所有關于這個函式的firestore示例中,他們在第一個引數中使用了一個集合參考而不是查詢
形成 Firestore 示例:
// Create a reference to the cities collection
import { collection, query, where } from "firebase/firestore";
const citiesRef = collection(db, "cities");
// Create a query against the collection.
const q = query(citiesRef, where("state", "==", "CA"));
它是相同的功能還是它的另一個簽名?
uj5u.com熱心網友回復:
集合參考是查詢的子類,因此無論 API 需要 a Query,您也可以傳遞 a CollectionReference。CollectionReference因此,您可以通過將 a 傳遞給函式來構建新查詢query,或者通過將 a 傳遞給現有查詢來向現有查詢添加條件Query。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/496542.html
標籤:javascript 火力基地 谷歌云火库
