I’m having difficulties querying all documents inside a subcollection in my Firestore database. (I am using Node.js) My goal is to get all the data from every document inside the subcollection named favorites My database structure looks like this. I looked at the documentation at https://firebase.google.com/docs/firestore/query-data/get-data but without any result how to solve the problem. My query looks like this
Tag: firebase
How to run a background Cloud Function and schedule a change in database?
I’m developing an app using React Native and Firebase Realtime database. I want to do something like this. From the app, I set a time duration and press a button. Then, it writes data to the Firebase. Assume that I set the time duration to 1000000000 ms and press the button. Then, the database looks like this: I want to
How to save date as Timestamp in firestore using firebase-admin?
Trying to convert from javascript date to firestore timestamp throws I tried it in 2 ways: Using firebase-admin Using firebase.firestore: date used as a param in new Date is of this format: “2017-01-29”. Expected result: firestore timestamp. Actual result: TypeError: Cannot read property ‘Timestamp’ of undefined Note: db nor firebase are null or undefined. Is there a definitive way of
Vuejs display result after completion of async request
I am displaying the name of the current user after querying it from the firestore database like so: then after fetching the result it should be something like below: However it does not display the name after the result is fetched immediately,since it takes some time. I am only able to show it after I change some property such as
update cloud firestore document without id
My Cloud Firestore looks like this: I want to update a document of users given I have an unique identifier for it that is NOT the random id of the document (suppose, for example, the name is unique and I want to use it as identifier). How can I update a document identifying it by a field of it? Answer
Accessing Geopoints using Firebase Cloud Functions?
I have a collection called posts in Firestore which contains a documents with the fields content and location. Content is a string and Location is a Geopoint. When accessing the database using Firebase Cloud Functions, I am able to print out the content by adding it into an array and JSON.stringfy the whole thing as a response. However, If i
Firebase database – filtering and ordering query
I’m working on a React Native app, and trying to set up a user research in the database, based on a given text. Here is my request code : Database looks like : The query returns what I want, but I have an error on each query only saying “@firebase/database:”. And nothing else… How can I fix it? Answer Most
How to delete object from array in firestore
I have a problem with deleting an Object out of an Array in firestore. I have this data in firestore: And now I would like to delete e.g the second Object out of the posts Array. Code: But I do not know how to define arrayRemove() These are the pictures and each one has a delete button to delete the
Getting all documents from one collection in Firestore
Hi I’m starting with javascript and react-native and I’m trying to figure out this problem for hours now. Can someone explain me how to get all the documents from firestore collection ? I have been trying this: Log 1 prints all the objects(one by one) but log 2 is undefined, why ? Answer The example in the other answer is
Firebase how to break realtime database transaction with different state/message if different condition is true?
is it a good practice at all and if yes what is the correct way to break a transaction with different error states/messages for different situations? I have a transaction running over an ‘offer’ entry doing ‘seats’ reservation: I want to break it if one of the following 3 conditions is true and return state/message to the caller function. if