Skip to content
Advertisement

Tag: google-cloud-firestore

Is there a way to get all documents in a subcollection (Firestore)

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

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

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

Advertisement