google-cloud-firestore

What happens if firestore fails to save data

拈花ヽ惹草 提交于 2021-01-29 12:30:27
问题 1 Suppose that i am doing something like following FirestoreDatabase.getInstance() .collection("users") .add(userData); // where userData is reference to UserData object which contains many fileds Now if i am showing that data in recyclerview , the client library will show that immediately in recyclerview even before it is saved in firestore database to keep my app more responsive. So when the data shows up in the recyclerview the user thinks he successfully added the data BUT what happens if

Firestore - Caching behaviour with data pagination

岁酱吖の 提交于 2021-01-29 12:26:45
问题 Going through the documentation, I implemented pagination but I am confused how firestore's local cache behave with pagination. Suppose my query is to get first 20 documents. For testing, I change paging size to 25 and start application again to get exactly same 20 documents(cached before) + 5 new documents. How does the cache mechanism will behave with respect to number of reads in this case? Will it cost 5 new reads or 25 new reads? I tried several times to see if firebase console stats

Accessing Firestore data outside of Function [duplicate]

走远了吗. 提交于 2021-01-29 11:42:59
问题 This question already has an answer here : Assign value of a Firestore document to a variable (1 answer) Closed 1 year ago . I have a FireStore function in my FirestoreService file as below; func retrieveDiscounts() -> [Discount] { var discounts = [Discount]() reference(to: .discounts).getDocuments { (snapshots, error) in if error != nil { print(error as Any) return } else { guard let snapshot = snapshots else { return } discounts = snapshot.documents.compactMap({Discount(dictionary: $0.data(

Is my function not resolving correctly? Also it won't write to firebase to the databse. No errors

情到浓时终转凉″ 提交于 2021-01-29 11:25:19
问题 I have a cloud function that runs with no errors, however, it won't write to the database after Promise.all I've tested this function in a web browser and the data seems to resolve correctly after the Promise.all. When I put this into a cloud function a console.log() after Promise.all shows the original data and not the updated data, as if it's skipping the forEach and resolving right away. I don't get this behavior when the function runs in a browser. On top of that, the data will not write

React Native Flat List (Infinite Scroll) is returning the duplicate records from Firebase

。_饼干妹妹 提交于 2021-01-29 11:18:18
问题 I was able to get Infinite Scroll working with React Native and Firebase, but there's an issue on retrieving the next 6 documents (limit is set to 6). It returns another 6 once the end of the list is refreshed, but it's the same 6 documents appended to the previous same 6 documents. I have the startAt increase each time 6 records are rendering and the startAt is increasing at the right amount. Not sure if I'm missing something or if it could be an async issue? // Imports: Dependencies import

@Id field annotation for storing POJO in Firebase Firestore?

本秂侑毒 提交于 2021-01-29 11:13:56
问题 We have a complex JSON having multiple sub-objects inside main object. For example: dept: { name: Dept1, emps: [ { empCode: 001, empName: Emp001 } ] } If we use db.collection("dept").add(deptPojo) then it auto creates "emps" subcollection and auto assigns document id for each emp object. But we want empCode to be assigned as document id for each emp document. Is this achievable? How? Is there any @Id annotation in firebase firestore api? 回答1: There is currently no way to indicate the ID using

Creating new collection in cloud firestore inside my code [duplicate]

旧城冷巷雨未停 提交于 2021-01-29 11:09:42
问题 This question already has an answer here : How to create a Collection in Firestore with node.js code (1 answer) Closed 1 year ago . So I was just wondering if there is any way to automatically put a new sub collection in the firestore? Basically my data structure is the main collection 'matches' and then I wanted to create subcollections with names of the seasons such as 's2018', 's2019' etc... So instead of putting it all manually in the console. I wanted to create a button to add a new

Accessing and using Firestore subcollection data using VueJS (rookie question)

為{幸葍}努か 提交于 2021-01-29 11:07:26
问题 I am fairly new to VueJs and Firestore and I am having a couple of rookie teething problems that I can't quite answer using the documentation. I apologise in advance if this is answered elsewhere, I have been trawling for the last couple of days and couldn't see anything that was directly helpful. So my problem is two-fold: 1) How do I access subcollections in Firestore? - I read that this functionality is now available and I believe you can dive into these subcollections using db

How to prevent firebase db access from chrome console or other methods

佐手、 提交于 2021-01-29 11:03:32
问题 So I have a single page frontend only app. Right now I have something like this // db.js import firebase from "firebase/app" import "firebase/firestore"; var firebaseConfig = { ... }; export const db = firebase .initializeApp(firebaseConfig) .firestore(); in main.js I was experimenting with putting the db instance in the global window scope just to see if I could go to the chrome web console and access it to submit a doc and indeed I can // main.js import { db } from './db' window.db = db;

How can I retrieve Firebase user properties?

↘锁芯ラ 提交于 2021-01-29 11:00:54
问题 Is there any way to retrieve Firebase user properties in Analytics for Firebase ? For example, Analytics has all user records. I want to retrieve a record about user information, such as country code, etc. using Analytics. Is there any API available for this? 回答1: Google Analytics for Firebase doesn't retain any PII (Personally Identifiable Information) about anyone using your app. It aggregates information across users. It doesn't associate specific user information from Firebase