google-cloud-firestore

Firestore pricing clarifications for offline cached data

自闭症网瘾萝莉.ら 提交于 2020-05-12 16:51:08
问题 It seems odd to me that Firestore would charge me for read queries to locally cached data, but I can't find any clarification to the contrary in the Firestore Pricing document. If I force Firebase into offline mode and then perform reads on my locally cached data, am I still charged for each individual entity that I retrieve? Second, offline users in my app write many small updates to a single entity. I want the changes to persist locally each time (in case they quit the app), but I only need

Firestore cloud function to recursively update subcollection/collectionGroup

梦想的初衷 提交于 2020-05-11 23:53:48
问题 I have this cloud function: import pLimit from "p-limit"; const syncNotificationsAvatar = async ( userId: string, change: Change<DocumentSnapshot> ) => { if (!change.before.get("published") || !change.after.exists) { return; } const before: Profile = change.before.data() as any; const after: Profile = change.after.data() as any; const keysToCompare: (keyof Profile)[] = ["avatar"]; if ( arraysEqual( keysToCompare.map((k) => before[k]), keysToCompare.map((k) => after[k]) ) ) { return; } const

Firestore cloud function to recursively update subcollection/collectionGroup

☆樱花仙子☆ 提交于 2020-05-11 23:49:44
问题 I have this cloud function: import pLimit from "p-limit"; const syncNotificationsAvatar = async ( userId: string, change: Change<DocumentSnapshot> ) => { if (!change.before.get("published") || !change.after.exists) { return; } const before: Profile = change.before.data() as any; const after: Profile = change.after.data() as any; const keysToCompare: (keyof Profile)[] = ["avatar"]; if ( arraysEqual( keysToCompare.map((k) => before[k]), keysToCompare.map((k) => after[k]) ) ) { return; } const

Firestore cloud function to recursively update subcollection/collectionGroup

自闭症网瘾萝莉.ら 提交于 2020-05-11 23:49:23
问题 I have this cloud function: import pLimit from "p-limit"; const syncNotificationsAvatar = async ( userId: string, change: Change<DocumentSnapshot> ) => { if (!change.before.get("published") || !change.after.exists) { return; } const before: Profile = change.before.data() as any; const after: Profile = change.after.data() as any; const keysToCompare: (keyof Profile)[] = ["avatar"]; if ( arraysEqual( keysToCompare.map((k) => before[k]), keysToCompare.map((k) => after[k]) ) ) { return; } const

Firestore cloud function to recursively update subcollection/collectionGroup

点点圈 提交于 2020-05-11 23:49:12
问题 I have this cloud function: import pLimit from "p-limit"; const syncNotificationsAvatar = async ( userId: string, change: Change<DocumentSnapshot> ) => { if (!change.before.get("published") || !change.after.exists) { return; } const before: Profile = change.before.data() as any; const after: Profile = change.after.data() as any; const keysToCompare: (keyof Profile)[] = ["avatar"]; if ( arraysEqual( keysToCompare.map((k) => before[k]), keysToCompare.map((k) => after[k]) ) ) { return; } const

Firestore cloud function to recursively update subcollection/collectionGroup

孤街浪徒 提交于 2020-05-11 23:48:56
问题 I have this cloud function: import pLimit from "p-limit"; const syncNotificationsAvatar = async ( userId: string, change: Change<DocumentSnapshot> ) => { if (!change.before.get("published") || !change.after.exists) { return; } const before: Profile = change.before.data() as any; const after: Profile = change.after.data() as any; const keysToCompare: (keyof Profile)[] = ["avatar"]; if ( arraysEqual( keysToCompare.map((k) => before[k]), keysToCompare.map((k) => after[k]) ) ) { return; } const

Firestore cloud function to recursively update subcollection/collectionGroup

随声附和 提交于 2020-05-11 23:48:22
问题 I have this cloud function: import pLimit from "p-limit"; const syncNotificationsAvatar = async ( userId: string, change: Change<DocumentSnapshot> ) => { if (!change.before.get("published") || !change.after.exists) { return; } const before: Profile = change.before.data() as any; const after: Profile = change.after.data() as any; const keysToCompare: (keyof Profile)[] = ["avatar"]; if ( arraysEqual( keysToCompare.map((k) => before[k]), keysToCompare.map((k) => after[k]) ) ) { return; } const

Firestore security rules get field/id of reference

不想你离开。 提交于 2020-05-11 06:52:13
问题 I have two collections - tenancies and users. A tenancy doc has a field called "landlordID" and is of type REFERENCE (not String). Now in my Firestore Security Rules I want to allow a tenancy to be updated ONLY IF the landlordID field of that tenancy matches with the uid of the user making the request, namely request.auth.uid . Read it as " allow a tenancy document to be updated if the user making the user is authenticated, hence request.auth.uid != null, and the landlordID field's ID should

Firestore security rules get field/id of reference

笑着哭i 提交于 2020-05-11 06:51:09
问题 I have two collections - tenancies and users. A tenancy doc has a field called "landlordID" and is of type REFERENCE (not String). Now in my Firestore Security Rules I want to allow a tenancy to be updated ONLY IF the landlordID field of that tenancy matches with the uid of the user making the request, namely request.auth.uid . Read it as " allow a tenancy document to be updated if the user making the user is authenticated, hence request.auth.uid != null, and the landlordID field's ID should

Disable querying collection in Firebase Cloud Firestore with rules

孤街醉人 提交于 2020-05-11 04:27:29
问题 I am using Firebase Cloud Firestore, and I want to modify my rules to restrict users from querying a collection. This should not be allowed: firestore().collection("users").get() But this should be allowed: firestore().collection("users").doc("someUserId").get() Currently, my rules look like this: match /users/{userId} { allow read; } but this rule allows the "users" collection to be queried. How can I allow single document gets, but not collection queries? 回答1: You can break read rules into