Questions tagged [google-cloud-firestore]

1

votes
1

answer
1.3k

Views

Swift Query Into Firebase Firestore Nested Array

I have nested data that I'd like to display in a tableView. My data is structured like so... /users /userid name: 'John' age: 23 /likedPosts 0:post1 1:post2 For the tableview I'd like to display these posts (which have their own collection of data). In order to do that I need to... 1) Get the coun...
pmanning
1

votes
2

answer
1k

Views

How to save a text with tabs and new lines in Firestore and get it back intact?

Realtime database used to add \n, \t, etc but it doesn't seem to be the case for Firestore. this might be something basic I'm missing. Either way, how can I save something like this and get it back with new lines and tabs intact: value: 'test newline another line' currently, I get it back like th...
TheeBen
1

votes
1

answer
674

Views

Firebase StartAfter in query not working as expected

I am using firebase firestore as my database and i have written firebase functions to retrieve data from the firestore database. What i am trying to achieve is pagination and as per the docs i have implemented the code for my firebase function. Below is the code: exports.getBillList = functions.htt...
Chetan
1

votes
2

answer
235

Views

Firestore Rules: validate data does not have field

So I currently have two roles for all users: isAdmin and isReader. An Admin is allowed to read and write data and an Reader is allowed to read data. When someone creates an account he has no rights. Not even isReader. Only an Admin can change rules. This is how I planned to do it: Once someone crea...
Jonas
1

votes
1

answer
197

Views

How/Can I manually call a trigger Firebase Function?

In our app we are constantly using callable functions and sometimes the cold start can be a headache, given the fact that we are still developing it and there are no users using them other than us. What we thought to speed up this process is to call every function (they're not much, around 20 at the...
Franco Muñiz
1

votes
1

answer
114

Views

Firestore Import - no error, but no changes

I'm attempting to use the instructions here: https://firebase.google.com/docs/firestore/manage-data/export-import to a) do periodic backups of data from my production instance, and b) copy data between production/staging/dev instances. For what it's worth, each instance is in a separate Firebase pro...
Josh
1

votes
1

answer
791

Views

How to inner-join in firestore

I want to build a view to show some events inside a listview in my app like this: I have these two tables: Users   Events But I don't know how do a 'inner join' between the tables USERS and EVENTS... I tried this: import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/materi...
Matheus Ribeiro
1

votes
1

answer
134

Views

Can debug logging be added to firestore rules functions?

Given that the firestore rules structure allows for functions, is there some way to add debug logs to those rule-functions ? .. in order to verify that the function you expect, is in fact being called. I see that with the simulator it shows a red X at the line in the rules sturcture, where access is...
Gene Bo
1

votes
1

answer
652

Views

Using Offline Persistence in Firestore in a Flutter App

I'm developing a app that uses Firebase's Firestore to send data to the web. One of the functions of the app is being able to save data in the device while being offline and send it to Firestore when internet connection is restored. I activated offline persistence but it dosen't work. DEBUG CONSOLE:...
Brenno Fagundes
1

votes
1

answer
133

Views

How to use wildcards in firestore cloud functions?

I'm trying to use a wildcard in a cloud function with firestore like this: exports.function_name= functions.https.onRequest((req, res) => { return admin.firestore().collection('users/messages/{messageCollectionId}') but it does not work. It works if I use an actual id, instead of the wildcard. Any h...
Raul Garcia
1

votes
2

answer
376

Views

Add a Document's Document ID to Its Own Firestore Document - Swift 4

How do I go about adding the document ID of a document I just added to my firestore database, to said document? I want to do this so that when a user retrieves a 'ride' object and chooses to book it, I can know which specific ride they've booked. The problem that i'm facing is that you can't get the...
yambo
1

votes
1

answer
107

Views

Difference between get() and snapshot() in Cloud Firestore

I am reading some data from Firebase's Cloud Firestore but I've seen several ways to do it. The example I saw used the get and onSnapshot function like this: db.collection('cities').doc('SF') .onSnapshot(doc => { console.log(doc.data()); }); or this var docRef = db.collection('cities').doc('SF'); do...
rubotero
1

votes
3

answer
894

Views

Failed to resolve: com.google.firebase:firebase-firestore:16.0.1

I'm switching from realtime database to firestore and I keep getting the same error: Failed to resolve: com.google.firebase:firebase-firestore:16.0.1 I have looked at similar questions on this site but still haven't been able to fix this problem. Here is the code from my app gradle: apply plugin: 'c...
minikate
1

votes
1

answer
35

Views

Updating chat messages efficiently (continuously) with Firebase's Firestore

I'm working on a React Native app that uses Firebase's Firestore for backend. Right now, every time a new message comes, I'm fetching all messages from the Firestore and updating my state, although it's just one new message that came. function listenCurrentChat(dispatch, chatID) { const address = 'c...
romin21
1

votes
1

answer
36

Views

Get/filter documents based on field id

I have around 20 documents in the Firebase database which each have fields with an 'id' with a value. How does one query the database to get/filter to return every document with a specific 'id' and omit the rest?
Vivendo
0

votes
1

answer
50

Views

Two different observable on same Firestore collection causing memory leaks and showing duplicate results

I'm using @angular/fire to fetch data from firestore. I have two components. one is parent and the other is child. Both of these components are subscribing to observable using async pipes. These are two different observables (but on the same collection). When i arrive on the child route i can see th...
Saad Ashfaq
0

votes
0

answer
5

Views

Firestore cloud listener, not working on collection inside collection

I am setting up a program which uses the Admin Sdk from Firebase, it needs to be able to update on any changes or documents added on a collection. The problem is that it doesn't update when it is a collection/document/collection/document/collection. my code is this. (doesn't work) import time import...
Joaquin Fernandez
1

votes
0

answer
20

Views

how can I redirect to another html file after being able to store data in firestore?

I've first made my web store data on firebase real time database and now I changed it to firestore but now I'm not quite sure how can I redirect after data has been posted to firestore I tried adding location.href = 'https://dr-elvic-tengco-web.firebaseapp.com/ThankYou.html'; under console.log('D...
1

votes
2

answer
258

Views

Firestore dynamically update security rules

Imagine we have Chat application and in this application, we have many rooms, some private and some for everyone. Every room has an admin who can manage users (can invite and remove). Only members of the room can read and write messages. An Admin is a person who created a room in this scenario. I wa...
svkaka
1

votes
2

answer
52

Views

Flutter:get document id form firstore when setData is called

How to get the newly created document id when we call setData Future createCommitment() async { await widget._firestore .collection('skills') .document(widget.skillID) .collection('commitment') .document() .setData({ 'bite_id': widget.biteId, 'start_date': widget.startDate, 'frequnecy': 3 }); } the...
M.Ali
1

votes
2

answer
46

Views

Querying data from Firestore to Arraylist but got nothing?

I have trouble adding data in ArrayList. I tried to add data in array list but got nothing Here's my code public class fmMain extends Fragment { private ArrayList posList = new ArrayList(); public fmMain() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater in...
Supagon Srisawas
1

votes
2

answer
53

Views

How to structure a search list in Firestore?

I want to show a list of artists in my app which the user will be able to search through. I'm not sure however how to save this in Firestore? First I created a collection 'searchLists' with a document for each DJ but that means a lot of document reads so that's out of the question. Now I created a d...
Bram-N
1

votes
2

answer
288

Views

Run a python script on schedule on Google App Engine

I'm looking for a good samaritan that can provide with a very basic skeleton to run a python script using Google App Engine. I have read the documentation, check on related SO questions but I'm lost with the WebApp format. All I want to do is run one python script which accepts arguments or several...
Racu
1

votes
2

answer
32

Views

How am I billed in Firestore for a whereEqualTo query?

I have a collection of 100 elements. In this collection, only two elements have the field available set to true. If I use this query: db.collection('elements').whereEqualTo('available', true); I get 2 elements. Am I billed with 2 read operations or 100? Thanks
Johans Bormman
1

votes
0

answer
8

Views

Moving a subcollection on CloudFirestore

We are planning to implement a virtual filesystem using Google Firestore. The idea of subcollections is nice because it allows us to model our data in terms of a folder hierarchy, like so: /folders/folderA/entities/folderB/entities/fileX Much like an actual filesystem, we'd like to handle cross-fold...
robinnnnn
1

votes
4

answer
46

Views

Angular - Getting item id and value from a HTML select

I'm using Angular and AngularFire to fetch a list of clients from Firestore. I have displayed them in a HTML dropdown (select). Upon selecting an item I would like to obtain the client.id and client.name So far, this is able to get me the client ID upon selection. What I would also like to get upon...
Que
0

votes
0

answer
5

Views

Passing a query to FirestoreRecyclerAdapter with sub set of documents from a collection

I want pass a query (as FirestoreRecyclerOptions) to my RecyclerView adapter that extends FirestoreRecyclerAdapter, so that the changes to the document will be automatically updated in the recycler view. The problem is, that I want to retrieve only some part of the documents in that collection (get...
DeadStar
2

votes
2

answer
153

Views

LiveData with multiple sources of different types

I currently have a project that contains a list of MyItem, and using Firebase/LiveData. It's structured into groups, and each group has items. I want to be able to update this list if any of the following happen: An item is updated (on the backend through Firebase) A filter is changed (a separate ta...
Advice-Dog
1

votes
1

answer
312

Views

Tracking if a User 'likes' a post

This is more of a theoretical how database should be setup, and less about programming. Lets say I have a news feed full of cards, which each contain a message and a like count. Each user is able to like a mesesage. I want it to be displayed to a user if they have already liked that particular card....
jdoej
1

votes
1

answer
219

Views

Switch Firestore ref if document does not exist

I'm trying to build the following: When a user request data, if the data does not exist, I want to provide a fallback Document. I'm using AngularFire2. Inspired by the doc here I thought I could use first the .get() method to check if the document exists then return the AngularFire2 Observable. But...
Benoit
1

votes
0

answer
207

Views

Cloud Firestore write ops do not work unless thread is blocked

I am using Cloud Firebase Java admin API to write data into my Firestore instance. All the methods writing some data into the Firestore return an instance of ApiFuture. Now, the problem is that unless I call get() method on the returned instance, the data does not make it to the Firestore. This pro...
Dmitriy
1

votes
1

answer
161

Views

Recyclerview is not displaying anything, any ideas? Using FirestoreUI RecyclerAdapter

The code Below I seem to have done everything needed, but the recyclerview is just not being populated. I even put the Log on OnDateChange to see if it's called, and it was called once on the LogCat after I ran it on my Galaxy S6. Also, the database is public. RecyclerView chat_view; EditText mess...
Baldric Nguena
1

votes
0

answer
396

Views

How can I return a String or Array from onComplete? - Android - Firestore

I'm programming an app that needs to fetch data in the Firestore data base. I created a Recyclerview that shows the results, but when I populate it, the information never arrives. I think is because I change the value of Cervezas inside the onCompleteListener. The method cargarDatos() is in the same...
Robertino Martinez
1

votes
2

answer
656

Views

can we update query of firestore recycler adapter without setting the whole adapter again?

I am using firestore recycler adapter to populate my documents in a recycler view like below. it is working fine. How can I update the query? query = FirebaseFirestore.getInstance() .collection('partners').orderBy('mCompanyName').limit(limitValue); options = new FirestoreRecyclerOptions.Builder() .s...
Shubham Sardar
1

votes
0

answer
299

Views

How do you make a storage reference in swift for Firestore

How do you create a field of type storage reference in the swift dictionary format using swift. I keep on getting an error saying that FIRStorageReference. This is the code below, photoRef is a storage reference: let newFirePhotoRef = newUserRef.collection('Photos').document() photoRef = photoRef.ch...
user372382
1

votes
0

answer
151

Views

How to add stripe token into firestore from website (javascript)

I'm using stripe API on our website. I took the card details from the user and encrypted in the form of token. I need to send the stripe token to firestore. I have added all the scripts regarding firestore but still, the token is not adding to firestore. In this file, I have both HTML and JavaScript...
Lahari Areti
1

votes
0

answer
420

Views

Cannot encode type ([object Object]) to a Firestore Value error while attempting pagination

So here I have my code notifull.get('/getNote', (request, response) => { // START Get variables var requestData = { // location properties subject: request.query.subject, category: request.query.category, subcategory: request.query.subcategory, // easy way to get full reference string referenceStrin...
Michael Brennan
1

votes
1

answer
254

Views

Speeding up Cloud Functions

I have a simple function that just executes a transaction to help keep a count of a list. However, I am noticing when I run it, it takes nearly 5 seconds to execute, which seems really slow for how simple the function is. Is there anything I can do or a faster way to keep a counter? exports.CountCom...
jdoej
1

votes
1

answer
376

Views

prevent a user from writing data to firestore if data exist

I am making an android app that when a user register an account on firebase, he saves his email, phone number and password. but when he wants to login, he uses his phone number and password. Because of that requirement I must also make the phone number unique There are a number of ways too do this b...
Ibrahim Usman
1

votes
0

answer
440

Views

Can redux be used in application that uses Flutter Cloud Firestore?

I am currently doing some experiments with Flutter Redux architecture, I notice that the state of the store changes in a uni direction. However, in my case, I'm using Cloud firestore, and I am required to listen to the changes to the database on the cloud, then updating the data on UI accordingly....
grepLines

View additional questions