fix(firestore): use update instead of set
Fixes:
@@ -125,9 +125,12 @@ func addDocAfterAutoGeneratedID(ctx context.Context, client *firestore.Client) e
func updateDoc(ctx context.Context, client *firestore.Client) error {
// [START fs_update_doc]
- _, err := client.Collection("cities").Doc("DC").Set(ctx, map[string]interface{}{
- "capital": true,
- }, firestore.MergeAll)
+ _, err := client.Collection("cities").Doc("DC").Update(ctx, []firestore.Update{
+ {
+ Path: "capital",
+ Value: true,
+ },
+ })
if err != nil {
// Handle any errors in an appropriate way, such as returning them.
log.Printf("An error has occurred: %s", err)
