Skip to content

Commit 9561e4d

Browse files
committed
Firestore: split on dots
1 parent a2f7a8a commit 9561e4d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

firestore/google/cloud/firestore_v1beta1/_helpers.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ def get_doc_id(document_pb, expected_prefix):
795795
return document_id
796796

797797

798-
def process_server_timestamp(document_data, top_level=True):
798+
def process_server_timestamp(document_data, split_on_dots=True):
799799
"""Remove all server timestamp sentinel values from data.
800800
801801
If the data is nested, for example:
@@ -829,8 +829,13 @@ def process_server_timestamp(document_data, top_level=True):
829829
}
830830
831831
Args:
832-
document_data (dict): Property names and values to use for
833-
sending a change to a document.
832+
document_data (dict):
833+
Property names and values to use for sending a change to
834+
a document.
835+
836+
split_on_dots (bool):
837+
Whether to split the property names on dots at the top level
838+
(for updates only).
834839
835840
Returns:
836841
Tuple[List[str, ...], Dict[str, Any]]: A two-tuple of
@@ -852,7 +857,7 @@ def process_server_timestamp(document_data, top_level=True):
852857
# Only add a key to ``actual_data`` if there is data.
853858
actual_data[field_name] = sub_data
854859
elif value is constants.SERVER_TIMESTAMP:
855-
if top_level:
860+
if split_on_dots:
856861
transform_paths.append(FieldPath(*field_name.split(".")))
857862
else:
858863
transform_paths.append(FieldPath.from_string(field_name))

0 commit comments

Comments
 (0)