Skip to content

Firestore set with merge true, will remove empty inner objects #1168

Closed
@mohshraim

Description

@mohshraim

[REQUIRED] Describe your environment

  • Operating System version: macOS Hight Sierra
  • Browser version: chrome Version 67.0.3396.99
  • Firebase SDK version: 5.4.1
  • Firebase Product: firestore

[REQUIRED] Describe the problem

Steps to reproduce:

when update document with set function and merge option true, i will lose the inner empty objects.

Relevant Code:


var doc = { obj1: { key1: true } , obj2: {} };

firestore.collection('item').doc('item-1').set(doc);
//without merge option
// the stored doc on firestore server will be  { obj1: { key1: true } , obj2: {}  }   => this correct
//******************************
firestore.collection('item').doc('item-1').set(doc, { merge: true });
//with merge option
// the stored doc on firestore server will be  { obj1: { key1: true }  }   => this missing the obj2

Is this normal behavior?
Thanks

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions