geofirex
geofirex copied to clipboard
feat: get key of the document
In firestore you can do
const carsRefs = await firestore.collection('cars').get()
for (let carRef of carsRefs.docs) {
carRef.data() // document data
carRef.id // document key
}
I can't find document key in response:
const cars = geo.collection('cars')
const field = 'position'
const center = geo.point(48.1548894, 11.471625)
const radius = 50
const query = cars.within(center, radius, field)
let docs = await get(query)
for (let doc of docs) {
doc // document data
// document key?
}
@razbakov The document data has a new property called id
mapped from the library, the value of the id
field is the documentID
or key.