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: google-cloud-firestore
How to increment a map value in a Firestore array
I have a firestore firebase database , in which I have a collection users there is an array in the collection and in the array there is a map in map there is a field qty.. I want to increment that qty value.. using increment doesnt help as the qty is inside a array index this is the error Output
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
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
How to handle for promise inside a piped map
I am definitely sure I am confused here so please any help is appreciated. Here is my scenario: I pull from Firestore a document: All is fine up to here. But inside the map I need a promise to resolve (or not) For example: I understand that the await cannot happen there. I am very confused how to solve this,
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
Add field separately to firestore document
The following code creates a firestore collection and adds data to it: I want to create another function which adds a field to the document at a different time. I have the following function but am getting the error “TypeError: collectionRef.update is not a function” Answer Build a DocumentReference to the document you want to update, then use the update()
Firebase Cloud Functions for Firestore are not triggering
Cannot get Firebase Cloud Functions for Firestore to trigger on onWrite of my collection. Trying to setup device to device push notification for chat app. Function is deployed and on Pay as you go plan, however, changes in document, updates or create in “chats” collection is not triggering. Firebase cloud messaging is supposed to send a push and write to