Is there any way to add an auto-field in firestore?

147 views
Skip to first unread message

Roy Tubic

unread,
Dec 7, 2020, 11:36:32 AM12/7/20
to Firebase Google Group
Hey everyone,

I'm trying to create a chat application using firestore, but I'm having an issue with chat histories. There currently is no field for a uid based on who you're your message is being sent to, so I'm unable to filter the chat history on a connection of the two uid's.

If I could add an auto field that picks up the receiver uid, then I think I could resolve this.

Is there any way to set up this field to automatcially pick up this the cloud firestore database?

Cheers

Kato Richardson

unread,
Dec 7, 2020, 1:17:56 PM12/7/20
to Firebase Google Group
Hi Roy,

There's no automated way to achieve this, but you can enforce that users enter their UID by doing something like the following in your rules:

allow write: if request.auth.uid == resource.data.uid

☼, Kato

--
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/a0a45981-da78-418d-9515-e6974890ba17n%40googlegroups.com.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Reply all
Reply to author
Forward
0 new messages