firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

[Feature Request] Firestore SetOptions.ignoreFields()

Open risalfajar opened this issue 3 years ago • 4 comments

What feature would you like to see?

We already have mergeFields(), it will be better to also have ignoreFields(). A possible use case would be when our data has a lot of fields, especially deep, nested, and dynamic ones which will be impossible to use mergeFields, while we just want to ignore one or two fields.

How would you use it?

Just the same as mergeFields(), it is just the opposite of it.

risalfajar avatar Apr 09 '22 00:04 risalfajar

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Apr 09 '22 00:04 google-oss-bot

Hi risalfajar, thanks for your ideas! Just want to double check, in the case like

let changes = {
  a: {
    b : {
      c: "c",
      d: "d",
      e: "e",
    }
  }
}

You suggest set(changes, SetOptions.ignoreFields("a.b.e")) is more helpful than set(changes, SetOptions.mergeFields("a.b.c", "a.b.d")) ?

cherylEnkidu avatar Apr 12 '22 19:04 cherylEnkidu

@cherylEnkidu yes, especially when the fields that we want to merge are dynamically added, like an id for example. We can't use mergeFields() in that case.

risalfajar avatar Apr 12 '22 21:04 risalfajar

I see, thanks for your suggestion again. I will make a note and discuss with the team :) Internal tracking ticket: b/228998129

cherylEnkidu avatar Apr 12 '22 21:04 cherylEnkidu