Skip to content

Conversation

@ehsannas
Copy link
Contributor

@ehsannas ehsannas commented Jul 1, 2025

This method calculates and returns the total size of the data stored in the DocumentSnapshot in bytes.

  • Iterates through the protobuf Value messages in the fields map.
  • Sums the getSerializedSize() of each Value.
  • Returns 0 if the document does not exist (fields is null).

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the samples format.

This method calculates and returns the total size of the data stored in the DocumentSnapshot in bytes.

- Iterates through the protobuf `Value` messages in the `fields` map.
- Sums the `getSerializedSize()` of each `Value`.
- Returns 0 if the document does not exist (fields is null).
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: firestore Issues related to the googleapis/java-firestore API. labels Jul 1, 2025
@ehsannas ehsannas closed this Jul 1, 2025
@ehsannas ehsannas reopened this Jul 1, 2025
google-labs-jules bot and others added 2 commits July 1, 2025 22:55
This method calculates and returns the total size of the data stored in the DocumentSnapshot in bytes.

- Iterates through the protobuf `Value` messages in the `fields` map.
- Sums the `getSerializedSize()` of each `Value`.
- Returns 0 if the document does not exist (fields is null).

Split the test case for `getDataSize` into two separate tests for existing and non-existent documents as per review feedback.
@ehsannas ehsannas closed this Jul 1, 2025
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/java-firestore API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants