From d95bac0ba7266c4331312ea9c9c6eb9ba9f92391 Mon Sep 17 00:00:00 2001 From: asoto31 Date: Wed, 13 Aug 2025 12:08:00 -0600 Subject: [PATCH 1/2] Update save_data_batch_writes.go client.Batch() is deprecated: https://pkg.go.dev/cloud.google.com/go/firestore#Client.Batch Instead client.BulkWriter() should be documented: https://pkg.go.dev/cloud.google.com/go/firestore#Client.BulkWriter --- firestore/save_data_batch_writes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firestore/save_data_batch_writes.go b/firestore/save_data_batch_writes.go index 66cdeee661..fea536a637 100644 --- a/firestore/save_data_batch_writes.go +++ b/firestore/save_data_batch_writes.go @@ -25,7 +25,7 @@ import ( func batchWrite(ctx context.Context, client *firestore.Client) error { // Get a new write batch. - batch := client.Batch() + batch := client.BulkWriter(ctx) // Set the value of "NYC". nycRef := client.Collection("cities").Doc("NYC") From 12629d5f134815ce637cb61a10326792ed7a69eb Mon Sep 17 00:00:00 2001 From: asoto31 Date: Wed, 13 Aug 2025 12:47:51 -0600 Subject: [PATCH 2/2] Update save_data_batch_writes.go Fix commit logic --- firestore/save_data_batch_writes.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/firestore/save_data_batch_writes.go b/firestore/save_data_batch_writes.go index fea536a637..a201f9b7ce 100644 --- a/firestore/save_data_batch_writes.go +++ b/firestore/save_data_batch_writes.go @@ -24,7 +24,7 @@ import ( ) func batchWrite(ctx context.Context, client *firestore.Client) error { - // Get a new write batch. + // Get a new write bulk. batch := client.BulkWriter(ctx) // Set the value of "NYC". @@ -43,14 +43,10 @@ func batchWrite(ctx context.Context, client *firestore.Client) error { laRef := client.Collection("cities").Doc("LA") batch.Delete(laRef) - // Commit the batch. - _, err := batch.Commit(ctx) - if err != nil { - // Handle any errors in an appropriate way, such as returning them. - log.Printf("An error has occurred: %s", err) - } - - return err + // Flush the bulk. + batch.Flush() + + return nil } // [END firestore_data_batch_writes]