NickyDLT
NickyDLT5mo ago

Is there a way to write a Firebase Doc Reference instead of a String?

Hey friends! Trying to update a parameter in Firebase but can't figure out how to make it a Doc Reference instead of just a String. Any thoughts?
Solution:
hey @NickyDLT, if you're using the "Update Field Value" node then it's been updated to try and convert valid string references i.e /users/H7sEUvlZaVRXgXnpSRZoTfJWUYn2 to a firestore doc reference. So if you re-add the node it should work now.
Jump to solution
8 Replies
Solution
Luis
Luis5mo ago
hey @NickyDLT, if you're using the "Update Field Value" node then it's been updated to try and convert valid string references i.e /users/H7sEUvlZaVRXgXnpSRZoTfJWUYn2 to a firestore doc reference. So if you re-add the node it should work now.
NickyDLT
NickyDLT5mo ago
Do you mean that that was updated after I asked the question? Also just to clarify, the particular example I'm working with currently is an array. if a user doc did not have the array yet, will the update to the node you're referring to still do what you're saying? Like, is the node detecting the content of the String and inferring it is meant to be a doc reference, or is it based on the pre-existing data? Thanks for your help!
Luis
Luis5mo ago
Yep updated after. So I'm not entirely sure which node you're using for doing the update but the "Update Field Value" node should now detect when your passing a reference as string and convert it to a valid reference before the update.
NickyDLT
NickyDLT5mo ago
Thanks so much! It seems to work! 🥳
moritz
moritz4mo ago
@Luis I tried that, but I am still getting a string for what is supposed to be a user reference: "/users/userid1234". Has anything changed since the node was last updated?
Luis
Luis4mo ago
Hey @moritz, actually the reference support has been moved to separate nodes. For retrieving data and filtering with a document reference you can use the "Collection Query (with Doc Ref)" node. Or for create data with document reference you can use the "Create Document (with Doc Ref)" node.
moritz
moritz4mo ago
Thank you @Luis, I got it to work. What really helped towards the solution was that bit of info that at the bottom of the description (see screenshot). The reason I did not see that in the first place and why my first attempts where unsuccessful is that I still had an "old" 'Create Document' node that did not display that extra bit of info. Personally, it would be great if either, nodes were automatically updated or if their description was updated.
No description
Luis
Luis4mo ago
Glad to hear you got it working, and also thank you for the valuable feedback. 🙂