Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save Document Reference from Cloud Function in Cloud Firestore?

Firestore allows me to add a field with the type "Reference" to a document. It's a reference "link" to other documents inside the Store.

While I imagine this is very handy, I'm missing documentation on it. I'm having some trouble saving a reference from a Firebase Cloud Function for example. On the client side, I just send a regular "ref" object via the client SDK and it saved the document-reference. In nodeJS (cloud function), I get an error that the object is too deep.

What's the proper way to save a field with the type reference from the admin SDK (and/or JS client SDK)?

like image 395
ProblemsOfSumit Avatar asked Feb 25 '26 14:02

ProblemsOfSumit


1 Answers

The Firebase Admin Node SDK was updated today and fixes this problem. https://github.com/firebase/firebase-admin-node/releases/tag/v5.4.2

like image 84
Morgan O'Neal Avatar answered Feb 27 '26 06:02

Morgan O'Neal