Closed DainisGorbunovs closed 3 years ago
Currently the data can be read from DocumentSnapshot using .data().
DocumentSnapshot
.data()
const snapshot = await firestore().collection('example').doc('document').get() const data = snapshot.data() const fieldValue = data?.fieldWeWant?.deeperField
However, sometimes it's easier to use a field path in order to read a specific field. This PR implements get() on DocumentSnapshot objects for such cases.
get()
const snapshot = await firestore().collection('example').doc('document').get() const fieldPath = 'fieldWeWant.deeperField' const fieldValue = snapshot.get(fieldPath)
Currently the data can be read from
DocumentSnapshot
using.data()
.However, sometimes it's easier to use a field path in order to read a specific field. This PR implements
get()
on DocumentSnapshot objects for such cases.