geofirex icon indicating copy to clipboard operation
geofirex copied to clipboard

feat: get key of the document

Open razbakov opened this issue 5 years ago • 1 comments

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 avatar Dec 04 '18 21:12 razbakov

@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.

DarshanGowda0 avatar Jan 23 '19 11:01 DarshanGowda0