我正在嘗試在 ionic 4 應(yīng)用程序/角度應(yīng)用程序中查詢 Firestore 子集合。我的數(shù)據(jù)庫如下所示 people(id) ----> tasks(id){ description : this is a description about a cat,<br> title: this is a cat <br> category: cat } 我正在使用 Firestore 函數(shù)來查詢集合中的所有數(shù)據(jù)。這是 Firestore 函數(shù)的樣子:import * as functions from 'firebase-functions';import * as admin from 'firebase-admin'admin.initializeApp() export const getFeed = functions.https.onCall(async (req,res) =>{ const docs = await admin.firestore().collection('people').limit(5).get() return docs.docs.map(doc => { return { postID: doc.id, ...doc.data() } }) })打字稿 home.ts 文件如下所示: const getFeed = this.aff.httpsCallable('getFeed') this.posts = getFeed({}).subscribe(data=> { console.log(data) // this.posts = data }) }我嘗試使用 array-contains 選項進(jìn)行查詢,但它不起作用。該數(shù)組在控制臺上顯示為空。 export const getFeed = functions.https.onCall(async (req,res) =>{ const docs = await admin.firestore().collection('people').where("category", "array- contains", "cat").limit(5).get() return docs.docs.map(doc => { return { postID: doc.id, ...doc.data() } }) })
如何使用 angular 查詢消防商店子集合?
嗶嗶one
2021-10-21 13:57:48