octabytes / FireO

Google Cloud Firestore modern and simplest convenient ORM package in Python. FireO is specifically designed for the Google's Firestore
https://fireo.octabyte.io
Apache License 2.0
250 stars 29 forks source link

Batched writes does not update id,key for local objects #119

Closed Deepak-Katchi closed 3 years ago

Deepak-Katchi commented 3 years ago

Hi,

I want to write a large set of records to firestore and once I write them to firestore, I do need the ids of those records For a single item, this can be done using item.save(); item.id But since I have a large set of documents batched writes is the optimum way. But when I do it

for item in items:
  item.save(batch)
batch.commit()

This writes items to firestore but when I do item[0].id it returns nothing

Deepak-Katchi commented 3 years ago

This happens with transactions too

AxeemHaider commented 3 years ago

Firestore does not return these ids because firestore handle these batch operations on their own side. This kind of thing is not support by firestore so FireO can't do it also