google-cloud-firestore

Flutter: Streambuilder causing far too many reads on Firestore

一世执手 提交于 2020-06-16 04:17:10
问题 I am trying to build a simple quotes Flutter app, where I show a list of quotes and allow users to 'like' the quotes. I am using the Streambuilder for that. My problem is that the Firestore usage dashboard shows a very high number of reads (almost 300 per user), even though I have 50 quotes at max. I have a hunch that something in my code is causing Streambuilder to trigger multiple times (maybe the user 'liking' a quote) and also the Streambuilder is loading ALL the quotes instead of only

Firebase Firestore 'Map' storage size

安稳与你 提交于 2020-06-16 04:12:48
问题 If I have a map saved in a document in Firestore, for example: aMap: { exampleKey1: 'value', } does that come to... 5 bytes, Map name 12 bytes, sum of each field name 6 bytes, sum of each field value ...Then according to https://firebase.google.com/docs/firestore/storage-size a 'Map' storage size is calculated the same as document size, which includes 32 additional bytes , and document name adds an extra 16 bytes . Do Maps incur theses additional bytes like documents do? 回答1: The docs states:

How to setup test data when testing Firestore Rules with Emulator?

大憨熊 提交于 2020-06-14 06:38:13
问题 I am working on tests for Cloud Firestore Rules, using mocha and Firestore Emulator , and the question is how to initialize some test data before running tests? To test my rules, I first need to initialize some test data. The problem is that I cannot put any data into a document when working with Emulator , documents only have id . I didn't find any example of setting up test data for Rules tests in the docs, so I tried to use both makeDocumentSnapshot from @firebase/testing and document

Flutter firestore compound query

拈花ヽ惹草 提交于 2020-06-14 06:16:04
问题 i'd like to know if there's a way to query firebase firestore collection in Flutter adding more than one field to the query. I tried some ways but i didn't realize how to do that. For example: CollectionReference col = Firestore.instance .collection("mycollection"); col.where('nome', isEqualTo: 'Tyg'); col.where('valor', isLessThan: '39'); Someone, please, have some way to do that? i am new in flutter and not getting the way. 回答1: Building Firestore queries follows a "builder pattern". Every

Querying Datastore using some of the indexed properties

寵の児 提交于 2020-06-13 12:17:54
问题 I am trying out Cloud Datastore's indexes, and I cannot figure out the configuration I need to resolve my queries. I have created a few entities of the same kind (named "object"), all of them with 5 properties named equally (property_0, property_1, ..., property_4). Then, I have created a composite index for that kind, indexing all 5 properties, and setting property_4 in the last place because I want to apply inequality filters on it. The definition of the index is: indexes: - kind: object

Querying Datastore using some of the indexed properties

巧了我就是萌 提交于 2020-06-13 12:16:19
问题 I am trying out Cloud Datastore's indexes, and I cannot figure out the configuration I need to resolve my queries. I have created a few entities of the same kind (named "object"), all of them with 5 properties named equally (property_0, property_1, ..., property_4). Then, I have created a composite index for that kind, indexing all 5 properties, and setting property_4 in the last place because I want to apply inequality filters on it. The definition of the index is: indexes: - kind: object

How to check if a document exists with a given id in firestore, without costing money?

感情迁移 提交于 2020-06-13 05:50:49
问题 I have a scenario where I have the phone number of the user and I want to check if the user is already registered on my app or not. To do this, I have a collection in firestore. In this collection, I the contact number of the individual user as a document. Whenever the user goes on the app and enters his mobile number, the app sends the request to search a specific document using final snapShot = await Firestore.instance.collection('rCust').document(_phoneNumberController.text).get(); My

SImple (and) dirty Firestore authentication rule

依然范特西╮ 提交于 2020-06-12 08:34:13
问题 I'm using REST API in a PHP project to send the data to Firestore DB through curl (PHP curl). I'm struggling in understanding how to setup an authentication rule for a "service" and the suggested approach through Google authorization looks overkilling to me. My data must be readable by ALL but writable just by my PHP server. So far I could ensure that a writing operation could happen only if in the dataset sent a specific code is provided (auth=123): service cloud.firestore { match /databases

Firebase Custom Domain Showing “Site Not Found”

雨燕双飞 提交于 2020-06-12 06:41:08
问题 I have verified the Domain Name Also, have linked the A records It's been 24 Hour's since the changes have been made to DNS Records Yet the screen remains same The app works perfectly on Firebase Default Domain. 回答1: If anyone comes here this might help. Usually, it happens because of some kind of error during picking DNS info between the 'www.example.com' and the 'example.com'. What worked for me, is to delete the domain from the firebase console and to reconnect it back. Don't change

Firestore query costs

ε祈祈猫儿з 提交于 2020-06-12 06:12:19
问题 On Firestore I have a social app that stores each user as a document, and queries based on users within a certain distance. If a user launched the app and had 1,000 users within 50 miles for example, would I be charged for 1000 reads for downloading all nearby profiles? That seems like it would be hyper expensive if I got charged that much every time a user queried nearby users. Is there a cheaper way to do this? 回答1: As far as I know, if your query returns 1 document, you'll be charged 1