Skip to content

docs: improve documentation for merge behavior #1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 22, 2021
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian requested review from a team as code owners December 21, 2021 17:42
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Dec 21, 2021
* @param {Array.<string|FieldPath>=} options.mergeFields - If provided, set()
* only replaces the specified field paths. Any field path that is not
* specified is ignored and remains untouched.
* specified is ignored and remains untouched. If your input sets any field to
* an empty map, all nested fields at this location are overwritten.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially confused since I inferred "location" to mean the document being set. The ambiguous interpretations:

  • all nested fields in the document location are overwritten with empty map, but top level fields remain
  • if the specified field has a nested field, it's deleted, but if the specified field maps to a value, it's not.

alternative suggestion: "if your input sets any field to an empty map, the specified field is (overwritten/set to) an empty map.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, this is a bit confusing. I don't like how your example uses "empty map" twice, but I think we can achieve the same by just removing "at this location". What do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that works!

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Firestore] API Feedback – Empty Object Merge Behavior
2 participants