google-cloud-firestore

Retrieve multiple items in Firestore

左心房为你撑大大i 提交于 2021-02-19 07:43:09
问题 I have the following data structure in Firestore: { items: [ itemId1: {}, itemId2: {}, itemId3: {} ], users: [ userId1: { itemIds: [ "itemId1", "itemId3" ] } ] } The goal of this data structure is for many users to have access to and collaborate on the same items. So moving the items into each user would be rather inefficient and difficult. If I have the userId ( userId1 ), I would like to query the items collection for all items that are within the user's itemIds array. So, in this example,

Per field rules in Firestore Security Rules

拟墨画扇 提交于 2021-02-19 07:36:08
问题 I have a bunch of documents that contain a few fields each. How can I write rules that only apply to a specific field in each document? For example, if my documents looked like this: { "displayName": "John Doe", // read and write "accessLevel": 3 // read only } How could I make it so that you can Read display name and access level Write to the display name Not write to the access level I've gone through a lot of videos and Firestore docs and haven't found anything that shows how you would

Per field rules in Firestore Security Rules

不问归期 提交于 2021-02-19 07:34:34
问题 I have a bunch of documents that contain a few fields each. How can I write rules that only apply to a specific field in each document? For example, if my documents looked like this: { "displayName": "John Doe", // read and write "accessLevel": 3 // read only } How could I make it so that you can Read display name and access level Write to the display name Not write to the access level I've gone through a lot of videos and Firestore docs and haven't found anything that shows how you would

How to update arrayList in cloud firestore in android

那年仲夏 提交于 2021-02-19 06:34:12
问题 Working with cloud firestore its always good to keep in mind about count of document read. I am working on an inventory app in which bill is getting generated for the list of products along with other details. Everything is working fine except the update of arraylist in the bill. I am able to insert the arraylist of product along with other details in the bill but i am not able to update the arraylist later. Whenever i try to insert more arraylist into the document, old arraylist get deleted.

How to update arrayList in cloud firestore in android

拈花ヽ惹草 提交于 2021-02-19 06:34:09
问题 Working with cloud firestore its always good to keep in mind about count of document read. I am working on an inventory app in which bill is getting generated for the list of products along with other details. Everything is working fine except the update of arraylist in the bill. I am able to insert the arraylist of product along with other details in the bill but i am not able to update the arraylist later. Whenever i try to insert more arraylist into the document, old arraylist get deleted.

How to limit number of document reads from a humongous collection in firestore when some malicious user queries the data?

非 Y 不嫁゛ 提交于 2021-02-19 06:13:45
问题 I have a firestore collection called letters which holds a public letter from users. In my app, I am using pagination to limit the results to 20 when they go to public letters screen . My concern is that this would work fine from within the app but if some malicious user query the database from let's say postman then I will be billed heavily for all those reads. I have all security rules in place like the user should be authenticated but this needs to be public collection so I can't think of

How to limit number of document reads from a humongous collection in firestore when some malicious user queries the data?

别说谁变了你拦得住时间么 提交于 2021-02-19 06:13:10
问题 I have a firestore collection called letters which holds a public letter from users. In my app, I am using pagination to limit the results to 20 when they go to public letters screen . My concern is that this would work fine from within the app but if some malicious user query the database from let's say postman then I will be billed heavily for all those reads. I have all security rules in place like the user should be authenticated but this needs to be public collection so I can't think of

How to limit number of document reads from a humongous collection in firestore when some malicious user queries the data?

笑着哭i 提交于 2021-02-19 06:12:42
问题 I have a firestore collection called letters which holds a public letter from users. In my app, I am using pagination to limit the results to 20 when they go to public letters screen . My concern is that this would work fine from within the app but if some malicious user query the database from let's say postman then I will be billed heavily for all those reads. I have all security rules in place like the user should be authenticated but this needs to be public collection so I can't think of

Firebase Cloud Functions - Delete Entries where timestamp field is over a month old and run daily

有些话、适合烂在心里 提交于 2021-02-19 05:38:10
问题 This is a two in one question. Part 1: I am storing data in Firestore, and one of my fields is an 'end_date' timestamp field. How can I write a cloud function, so that when this field is over a month in the past, the record is deleted? Part 2: How can I get this to run every day? 回答1: You can solve this problem, and related problems, relatively easy by combining the following technologies: Nodejs, firebase-admin SDK, and the async/await pattern. This is not a full solution, but just to give

Firebase firestore timestamp based security rules

你离开我真会死。 提交于 2021-02-19 05:33:37
问题 On my client side I am creating a document with one of the fields "createdDate" below is a payload from the firestore simulator { "__name__": "/databases/(default)/documents/billing/aaaa", "data": { "createdDate": 1529237500239, "createdDateTimeFormat": "2018-06-12T07:00:00.000Z" } } I tried to set the security rule to make sure the "createdDate" is not in the future. service cloud.firestore { match /databases/{database}/documents { match /billing/{userId}{ allow create: if (request.resource