Skip to content

Empty objects clear updated fields using set with merge #1371

Closed
@mchyb

Description

@mchyb

Environment

  • Operating System version: any
  • Browser version: Chrome 70.0.3538.77 (64-bit)
  • Firebase SDK version: 5.5.7
  • Firebase Product: firestore

Steps to reproduce:

  1. Create a document in any collection with a field of object type:
{
  "field": {
    "nested": "value"
  }
}
  1. Update the field with empty object using set with merge flag:
ref.set({ field: {} }, { merge: true });

Expected result of operation:

{
  "field": {
    "nested": "value",
  }
}

Actual result:

{
  "field": {}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions