google-cloud-firestore

Check if a field exists - search through Firestore database

[亡魂溺海] 提交于 2020-06-23 14:12:39
问题 I am doing a project for school - android app which registers users to realtime database after it checks if there's a corresponding card number and phone number in a different database in Firestore. At the moment it verifies only the first document, but it wouldn't find the fields if I search for them in other documents. This is the method I use: public void checkIfCardExists() { Query query = cardInfo.whereEqualTo("CardNo", cardNumber) .whereEqualTo("Phone", userPhone); query.get()

Error when connecting to firebase/firestore: Could not reach Cloud Firestore backend

陌路散爱 提交于 2020-06-23 14:12:11
问题 I am developing an app in swift and using Firestore to store my data. It’s the first time that I am using Firebase. Yesterday I connected the firebase and firestore to my project and everything worked fine. Today suddenly I got an error that It could not connect to the Firestore backend. 2020-04-03 13:37:25.851931+0200 Bouwresten[14277:2448929] 6.21.0 - [Firebase/Firestore][I-FST000001] Could not reach Cloud Firestore backend. Connection failed 1 time. Most recent error: Network connectivity

Check if a field exists - search through Firestore database

扶醉桌前 提交于 2020-06-23 14:11:45
问题 I am doing a project for school - android app which registers users to realtime database after it checks if there's a corresponding card number and phone number in a different database in Firestore. At the moment it verifies only the first document, but it wouldn't find the fields if I search for them in other documents. This is the method I use: public void checkIfCardExists() { Query query = cardInfo.whereEqualTo("CardNo", cardNumber) .whereEqualTo("Phone", userPhone); query.get()

Check if a field exists - search through Firestore database

倾然丶 夕夏残阳落幕 提交于 2020-06-23 14:11:21
问题 I am doing a project for school - android app which registers users to realtime database after it checks if there's a corresponding card number and phone number in a different database in Firestore. At the moment it verifies only the first document, but it wouldn't find the fields if I search for them in other documents. This is the method I use: public void checkIfCardExists() { Query query = cardInfo.whereEqualTo("CardNo", cardNumber) .whereEqualTo("Phone", userPhone); query.get()

Include the document id as a field id in firestore

牧云@^-^@ 提交于 2020-06-23 11:02:47
问题 Heres what i am trying to achieve i want a unique id field for every document in my database and i want that unique id to the same as the document id. Example: documents: data: eBgdTRE123 id:'eBgdTRE123' name:'Jhon Doe' job:'Programmer' i want i databse to have this structure, now i got two ideas to achieve this 1: to use cloud function and have onCreate listener and everytime theres a new document grab document and set the id field and update it heres how i am doing it exports

stop Firestore warning that everyone can read data

别说谁变了你拦得住时间么 提交于 2020-06-23 06:51:30
问题 I am getting a warning email from Firebase Firestore every day saying that: "any user can read your entire database" But in my case it's an open database where everyone can read the data. I have set up my security rules like so: service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read: if true; allow write: if request.auth.uid == 'xxxxx'; } } } What is the problem and how do I stop this warning email? 回答1: You can turn these emails off from the

Firebase date range query to fetch documents that have starDate and endDate

心不动则不痛 提交于 2020-06-23 04:53:28
问题 I have a collection of tasks on my Firestore database like this: "tasks": { v8NC4GovVOPe21fhwtp0 : { id: "v8NC4GovVOPe21fhwtp0" status: 0 dateFrom: 30 april 2019 at 00:00:00 UTC-3 dateTo: 05 may 2019 at 00:00:00 UTC-3 .... }, v7NC4GaxVOPe48ftstp1 : { id:"v7NC4GaxVOPe48ftstp1" status: 0 dateFrom: 29 april 2019 at 00:00:00 UTC-3 dateTo: 02 may 2019 at 00:00:00 UTC-3 .... } } The document has a dateFrom field, which indicates the first date the user can start working on that task and an dateTo

Firebase date range query to fetch documents that have starDate and endDate

天涯浪子 提交于 2020-06-23 04:53:27
问题 I have a collection of tasks on my Firestore database like this: "tasks": { v8NC4GovVOPe21fhwtp0 : { id: "v8NC4GovVOPe21fhwtp0" status: 0 dateFrom: 30 april 2019 at 00:00:00 UTC-3 dateTo: 05 may 2019 at 00:00:00 UTC-3 .... }, v7NC4GaxVOPe48ftstp1 : { id:"v7NC4GaxVOPe48ftstp1" status: 0 dateFrom: 29 april 2019 at 00:00:00 UTC-3 dateTo: 02 may 2019 at 00:00:00 UTC-3 .... } } The document has a dateFrom field, which indicates the first date the user can start working on that task and an dateTo

Firestore security rules in to prevent sensitive field

只谈情不闲聊 提交于 2020-06-22 04:32:31
问题 I am modeling a database with Firestore, for a small company. I have a collection of departments. Each department is a document. In the company, there will never be more than 50 employees. I would like to keep each employee as a map. so a department document will be like this; { emp1: { name: 'tom', age:23, email: 'tom@x.com'}, emp2: { name: 'mike', age:35, email: 'mike@x.com'} } I would like to keep the age field private, it should be accessed only by superusers. From what I learnt, it is

Firestore — Get only the changed documents in a large synced collection

冷暖自知 提交于 2020-06-22 04:25:06
问题 I've read all of the questions below, and cannot find anything in the docs to describe how to sync a collection and receive only changed documents from a collection. I've got over 500 documents in my synced collection (using redux-saga-firebase syncCollection) but usually only about 100 of them ever change. At any given time, even fewer will change, but I'm currently getting all 500+ documents back when even one changes, which results in 500+ reads. Not ideal, and will cost me at scale. Here