Kobe Forrosuelo
Kobe Forrosuelo

Reputation: 233

Firestore v: 5.5.6 | Cannot read property 'doc' of undefined

enter image description here

I have an error on firestore, my guess is that the tutorial i read has older version than mine. My question is, what would be the correct code in the version 5.5.6?

I highlighted the problem.

Upvotes: 2

Views: 2141

Answers (1)

sosmii
sosmii

Reputation: 292

docChanges is a method (See here) .

so your code should be like:

(querySnapshot.docChanges())[0].doc.data().userId ? true : false

haven't tested yet, though it should work if the document is correct.
See also:
https://firebase.google.com/docs/reference/js/firebase.firestore.DocumentChange https://firebase.google.com/docs/reference/js/firebase.firestore.QueryDocumentSnapshot

Upvotes: 1

Related Questions