google-cloud-firestore

How to get document id from firestore database

会有一股神秘感。 提交于 2020-06-17 15:11:38
问题 I'm trying to retrieve a document id by calling doc.getId() but I can't call it from this code db.collection("Pegawai").addSnapshotListener(new EventListener<QuerySnapshot>() { @Override public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) { if(e != null) { Log.d(TAG, e.toString()); } if (queryDocumentSnapshots != null) { for (DocumentChange doc: queryDocumentSnapshots.getDocumentChanges()) { if (doc.getType() == DocumentChange.Type.ADDED

How to get document id from firestore database

泪湿孤枕 提交于 2020-06-17 15:08:47
问题 I'm trying to retrieve a document id by calling doc.getId() but I can't call it from this code db.collection("Pegawai").addSnapshotListener(new EventListener<QuerySnapshot>() { @Override public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) { if(e != null) { Log.d(TAG, e.toString()); } if (queryDocumentSnapshots != null) { for (DocumentChange doc: queryDocumentSnapshots.getDocumentChanges()) { if (doc.getType() == DocumentChange.Type.ADDED

How to get document id from firestore database

梦想的初衷 提交于 2020-06-17 15:08:21
问题 I'm trying to retrieve a document id by calling doc.getId() but I can't call it from this code db.collection("Pegawai").addSnapshotListener(new EventListener<QuerySnapshot>() { @Override public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) { if(e != null) { Log.d(TAG, e.toString()); } if (queryDocumentSnapshots != null) { for (DocumentChange doc: queryDocumentSnapshots.getDocumentChanges()) { if (doc.getType() == DocumentChange.Type.ADDED

StreamProvider works correctly, however on stream update child widgets don't rebuild. UI not updating

我们两清 提交于 2020-06-17 15:07:10
问题 I'm using a StreamProvider in flutter to listen to my firebase collection. The stream works correctly however since I'm passing down the value of the stream provider to other child widgets(all of which are stateless) the child widgets don't rebuild even though the stream is correctly updated. This is my stream provider StreamProvider<List>.value( value: ChatService(shadeUID: widget.poll.shadeUID, pollUID: widget.poll.uid).threads, child: ThreadsList(poll: widget.poll, shadowUID: widget

How to get rid of __key__ columns in BigQuery table for every 'Record' Type field?

流过昼夜 提交于 2020-06-17 14:50:34
问题 For every 'Record' Type of my Firestore table, BigQuery is automatically adding the ' key ' columns. I do not want to have these added for each of the 'Record' Type fields. How can I get rid of these extra columns automatically being added by BigQuery? (I want to get rid of the below columns in my BigQuery table schema highlighted in yellow) 回答1: This is intended behavior, citing Bigquery GCP documentation: Each document in Firestore has a unique key that contains information such as the

How to create “likes count” Cloud Firestore aggregate function?

↘锁芯ラ 提交于 2020-06-17 13:21:47
问题 I am newb to firebase, I want to create an aggregate function for the likes count. I have three root collection: feeds, likes, and users. feeds have the following fields: description: <description of feed> likeCount:<Total count of like> title: <feed title> userId: <userId of feed> likes have the following fields: feedId: <id of the feed where a user gives like> likeBy: <id of the user who likes the feed> likeTo: <id of the user how created a feed> users have the following fields: username:

Executing collection group queries in a specific FireStore collection

走远了吗. 提交于 2020-06-17 13:08:47
问题 I have a database structure as follows (simplified for purposes of this question): Collection: item_A -> Document: params = {someParameter: "value"} -> Document: user_01 -> Sub-collection: orders -> Document: order_AA = {type: "A1", address: {pincode: "000000", city:"Paris"} -> Document: order_AB = {type: "A2", address: {pincode: "111111", city:"London"} ... -> Document: user_02 -> Sub-collection: orders -> Document: order_AC = {type: "A1", address: {pincode: "222222", city:"Berlin"} ->

What is the best way to store data from Firebase to SQLite or offline in flutter?

风流意气都作罢 提交于 2020-06-17 11:46:29
问题 In my app when user is offline, I want data to store in local db and then sync data with firebase. 回答1: Both FireStore and Realtime Database have offline persistence. Firestore : Firestore.instance.settings(persistenceEnabled: true) In the case of Firebase Realtime database, you don't need anything specific to set-up. Offline connectivity is automatic. So, the following line does the trick : databaseReference.child(dbKey).set(data); 来源: https://stackoverflow.com/questions/61315478/what-is-the

What is the best way to store data from Firebase to SQLite or offline in flutter?

▼魔方 西西 提交于 2020-06-17 11:45:25
问题 In my app when user is offline, I want data to store in local db and then sync data with firebase. 回答1: Both FireStore and Realtime Database have offline persistence. Firestore : Firestore.instance.settings(persistenceEnabled: true) In the case of Firebase Realtime database, you don't need anything specific to set-up. Offline connectivity is automatic. So, the following line does the trick : databaseReference.child(dbKey).set(data); 来源: https://stackoverflow.com/questions/61315478/what-is-the

How to access sub-collections across multiple documents within a single collection in firestore?

放肆的年华 提交于 2020-06-17 09:39:12
问题 I have a database structure as follows (simplified for purposes of this question): Collection: registrations -> Document: params = {someParameter: "value"} -> Document: user_01 -> Sub-collection: orders -> Document: order_AA = {type: "Q1", address: {pincode: "000000", city:"Paris"} -> Document: order_AB = {type: "Q2", address: {pincode: "111111", city:"London"} ... -> Document: user_02 -> Sub-collection: orders -> Document: order_AC = {type: "Q1", address: {pincode: "222222", city:"Berlin"} -