google-cloud-firestore

How to use valueChanges() instead of get() to download data with JSON string?

∥☆過路亽.° 提交于 2020-04-30 06:31:25
问题 I have a form with two different buttons, one to download data (from Firestore) and one to display it in realtime. For this I have two functions (Angular 8), where one uses valueChanges() to display data in realtime and the other uses get() to get the same data and download it. The user can choose to specify search more or less, so I have quite a lot of code for making the query and this needs to be doubled if I am to use both get() and valueChanges() . I am therefore wondering if someone can

Batch writing in firestore, can I write children before parents?

拜拜、爱过 提交于 2020-04-30 06:28:18
问题 My app parses some JSON and creates data like this: School -- has several sub collections... | Classrooms -- about 25 docs | Staff -- about 30 docs | Families -- ~350 docs, each with sub collections... | Parents -- a few docs, usually 2 | Students -- a few docs, usually 1 or 2 In all, there are about 1500 docs which I write in several batch sets using the following code (for creates, it uses only 'set'): // this.batchOps is a large array of: // [ { operation:'set', ref: firestore ref, data: {

Design decision between Firestore functions or triggers [closed]

[亡魂溺海] 提交于 2020-04-30 06:25:46
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 11 hours ago . Client side platform I am using is Web Angular. Brief explanation: when I create a Task, I add followers in it, for example 3 followers. Now once Task is saved. I want to push 3 records in 3 different documents. Do I create a for loop at client side? Use Firestore triggers?

Design decision between Firestore functions or triggers [closed]

别说谁变了你拦得住时间么 提交于 2020-04-30 06:25:27
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 11 hours ago . Client side platform I am using is Web Angular. Brief explanation: when I create a Task, I add followers in it, for example 3 followers. Now once Task is saved. I want to push 3 records in 3 different documents. Do I create a for loop at client side? Use Firestore triggers?

Return List of <T> from firestore collections

∥☆過路亽.° 提交于 2020-04-30 05:05:11
问题 How can I return a List of type T from firestore collections? Here is where I get which result in an error because the return type is of type List<Map<String, dynamic>> Future<List<T>> getCollections<T>(String path) async { final data = await Firestore.instance.collection(path).getDocuments(); final result = data.documents.map((doc) => doc.data).toList(); return result; } 回答1: try final result = data.documents.map<T>((doc) => doc.data as T); 来源: https://stackoverflow.com/questions/61287187

Firestore - Cloud Functions - Get uid

。_饼干妹妹 提交于 2020-04-29 08:19:06
问题 I'm trying to get the UID of the user authenticated by firebase web sdk, in the cloud function. The cloud function is triggered by onWrite event of cloud firestore. This function is triggered when the logged in user is creating/updating items to the cafe. The authentication is handled by Firebase Auth . The security rules enable write only for logged in users. So this event could be tied to a user. export const cfun = functions.firestore.document('cafes/{cafeId}/items/{itemId}').onWrite(async

Rendering a firestore timestamp in react

家住魔仙堡 提交于 2020-04-28 21:19:33
问题 I have been trying for months to figure out how to display a firestore timestamp in react. In December 2019, the solution I accepted on this post worked. It no longer works. I'm back to stuck. I have a firebase.js helper to record dates with: class Firebase { constructor() { app.initializeApp(config) this.firestore = app.firestore(); this.auth = app.auth(); this.serverTimestamp = app.firestore.FieldValue.serverTimestamp; } I use that helper in forms to record the date an entry is created like

Rendering a firestore timestamp in react

删除回忆录丶 提交于 2020-04-28 21:17:02
问题 I have been trying for months to figure out how to display a firestore timestamp in react. In December 2019, the solution I accepted on this post worked. It no longer works. I'm back to stuck. I have a firebase.js helper to record dates with: class Firebase { constructor() { app.initializeApp(config) this.firestore = app.firestore(); this.auth = app.auth(); this.serverTimestamp = app.firestore.FieldValue.serverTimestamp; } I use that helper in forms to record the date an entry is created like

Rendering a firestore timestamp in react

China☆狼群 提交于 2020-04-28 21:16:26
问题 I have been trying for months to figure out how to display a firestore timestamp in react. In December 2019, the solution I accepted on this post worked. It no longer works. I'm back to stuck. I have a firebase.js helper to record dates with: class Firebase { constructor() { app.initializeApp(config) this.firestore = app.firestore(); this.auth = app.auth(); this.serverTimestamp = app.firestore.FieldValue.serverTimestamp; } I use that helper in forms to record the date an entry is created like

Rendering a firestore timestamp in react

Deadly 提交于 2020-04-28 21:15:34
问题 I have been trying for months to figure out how to display a firestore timestamp in react. In December 2019, the solution I accepted on this post worked. It no longer works. I'm back to stuck. I have a firebase.js helper to record dates with: class Firebase { constructor() { app.initializeApp(config) this.firestore = app.firestore(); this.auth = app.auth(); this.serverTimestamp = app.firestore.FieldValue.serverTimestamp; } I use that helper in forms to record the date an entry is created like