Skip to content
Advertisement

Tag: google-cloud-firestore

How to get users document id in Firestore using Javascript?

how to get only the last document id in Firestore? i tried the result i’m getting wrong id thats not in the orders document!! This is my documents : Answer You are running db.collection(‘users’).doc(user.uid).collection(‘orders’).doc() twice which creates 2 different DocumentReferences and hence they are different. If you are trying to get the document that you just added try this:

Advertisement