Firestore document reference & protobuf

166 views
Skip to first unread message

Gil Salomon

unread,
May 27, 2021, 5:32:42 AM5/27/21
to Firebase Google Group
Firestore currently have document reference which is a lot like DB foreign key.
However I was wondering how does it play with protobuf? can I add a reference to a message stored in a firestore document inside a protobuf message and upload it to firestore so it will show there as reference?
I searched but didn't see anything of the sort in proto3 reference.

Sam Stern

unread,
May 27, 2021, 5:55:39 AM5/27/21
to Firebase Google Group
Hi Gil,

Are you using Firestore with protobufs via the RPC API? In the REST/RPC API the Reference data type is defined with "referenceValue: <string>":

In the end there is nothing special about a Reference, it's simply a stronger type for "string" which ensures that it represents a valid Cloud Firestore document or collection path. I generally advise people not to use this type actually, as simple strings are often much easier to work with and it's not hard to add your own validation.

- Sam

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/e831ba71-bd06-463d-b1e6-198dac465021n%40googlegroups.com.

Gil Salomon

unread,
May 28, 2021, 12:05:13 PM5/28/21
to Firebase Google Group
Thanks Sam,
I see your point no real benefit in this reference type over string


Reply all
Reply to author
Forward
0 new messages