google-cloud-firestore

Flutter Firestore take long retrieving data while offline

只愿长相守 提交于 2020-06-12 03:50:12
问题 I am using Firestore in flutter application. Each time user launch the application it retrieves some data from Firestore Cloud. QuerySnapshot dataSnapshot = await Firestore.instance .collection('/data') .getDocuments(); When user opens the application on first time, it required from him to connect online, to get the data, and as Firebase documents say For Android and iOS, offline persistence is enabled by default. To disable persistence, set the PersistenceEnabled option to false. So, it

Firestore database query, ignore case (case insenstive) and like clause.

六月ゝ 毕业季﹏ 提交于 2020-06-10 15:23:28
问题 Basically I am writing a search function on a Firestore document field. I want to write equivalent of below SQL. I am not finding solution to proceed. SELECT * FROM employee WHERE lower(employee_name) LIKE '%johny%'; 回答1: There is no like operator. See all available operators at: https://firebase.google.com/docs/firestore/query-data/queries The page also contains different ways on querying the database. For case insensitive sorting / querying please see the answer at Cloud Firestore Case

Can I query a Cloud Firestore collection with a where equals clause and an orderby?

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-10 15:09:04
问题 The documentation states: However, if you have a filter with a range comparison (<, <=, >, >=), your first ordering must be on the same field: That implies that I can use the non-range comparison, "==", with the orderBy clause. But this fails: myCollectionRef.where('age', '==', 2).orderBy('name'); 回答1: If you wanted to order a query with one or more equality filters, where the ordering is by a different field, you'll need to create a composite index. You can read more about this in our

Can I query a Cloud Firestore collection with a where equals clause and an orderby?

╄→尐↘猪︶ㄣ 提交于 2020-06-10 15:08:13
问题 The documentation states: However, if you have a filter with a range comparison (<, <=, >, >=), your first ordering must be on the same field: That implies that I can use the non-range comparison, "==", with the orderBy clause. But this fails: myCollectionRef.where('age', '==', 2).orderBy('name'); 回答1: If you wanted to order a query with one or more equality filters, where the ordering is by a different field, you'll need to create a composite index. You can read more about this in our

Firebase - Targeting Specific Firestore Document Field with Cloud Functions

╄→гoц情女王★ 提交于 2020-06-10 09:16:37
问题 When using Cloud Functions with the Firebase Realtime Database you are able to target a specific field with a cloud function. For example, given this JSON structure, I could target when user1's email field changed with a ('/user/{userId}/email').onUpdate cloud function. { "user": { "user1": { "name": "John Doe", "phone": "555-5555", "email": "john@gmail.com" } } } Now with Firestore it seems that I can't target a specific field and can only target documents. If this is the case a Firestore

How to query data across collections in Firestore?

自闭症网瘾萝莉.ら 提交于 2020-06-10 04:12:25
问题 It is written in the documentation below that "If you need to query data across collections, use root-level collections." https://cloud.google.com/firestore/docs/data-model If anyone knows an example of querying data across root-level collections in Firestore then please share the same. 回答1: I'm not sure of your specific scenario. Here's how to get comments (from 'commentsCollection' collection) related to an article. Assume article documents are set up like this: firestore:

Cloud Firestore: how to fetch a document reference inside my collection query and map it as a JSON value?

橙三吉。 提交于 2020-06-10 02:39:46
问题 Let's say I have a collection of comments. Every comment object has a "doc ref" to the user who posted. I need a query that will return a list of comments including the value of every single user reference, so my query returns a nice formatted of Json comment objects. 回答1: A similar question was asked here What is firestore Reference data type good for?, I don't think it is possible to do what you are asking according to this answer https://stackoverflow.com/a/46570119/473453. You have to

Is it possible to get all documents in a Firestore Cloud Function?

℡╲_俬逩灬. 提交于 2020-06-09 12:51:28
问题 I want to update a value on all documents in a collection using cloud functions as they are dependent on the creation date, but looking through the Cloud Firestore Triggers examples it looks like all events are only able to access a single document. Is there a way to loop over all documents? 回答1: You'd typically use the Admin SDK for that in your Cloud Functions code. Once you have that, it's a matter of read the collection as usual. Check the node examples in the firebase documentation on

how to fetch documents from one month old only firestore

[亡魂溺海] 提交于 2020-06-09 05:48:09
问题 I'm doing a query to fetch only 1 month old documents. I store the creation time of the document itself timestamp : 9 Apr, 2020 10:03:43 AM Now, in my query , I want to get all the documents whithin the current month but I dont want to use currentDate from my client (so it cannot be changed) but also I dont want to query that document to find the timestamps of that document Query FirebaseFirestore.getInstance().collection("orders").whereEqualTo("shopId",shopId) .whereEqualTo("status", 7)

Missing or insufficient permissions during post a document to Firestore using Custom Token

南楼画角 提交于 2020-06-09 05:41:09
问题 Final Goal: my company will start use Firestore to update transaction status to our Mobile Application and Angular 9 frontend. Immediate challenge: learn how use Custom Token. Current issue: I get this erro although it is owner: "error": { "code": 403, "message": "Missing or insufficient permissions.", "status": "PERMISSION_DENIED" } I can't understand why getting PERMISSION_DENIED if the idToken is related to the Collection Owner. IAM Admin showing the user is owner: Steps to reproduce: 1 -