@@ -823,29 +823,29 @@ def process_server_timestamp(document_data, split_on_dots=True):
823823 transform_paths = []
824824 actual_data = {}
825825 for field_name , value in six .iteritems (document_data ):
826+ if split_on_dots :
827+ top_level_path = FieldPath (* field_name .split ("." ))
828+ else :
829+ top_level_path = FieldPath .from_string (field_name )
826830 if isinstance (value , dict ):
827831 sub_transform_paths , sub_data , sub_field_paths = (
828832 process_server_timestamp (value , False ))
829- for sub_path in sub_transform_paths :
830- field_path = FieldPath .from_string (field_name )
831- field_path .parts = field_path .parts + sub_path .parts
832- transform_paths .extend ([field_path ])
833+ for sub_transform_path in sub_transform_paths :
834+ transform_path = FieldPath .from_string (field_name )
835+ transform_path .parts = transform_path .parts + sub_transform_path .parts
836+ transform_paths .extend ([transform_path ])
833837 if sub_data :
834838 # Only add a key to ``actual_data`` if there is data.
835-
836839 actual_data [field_name ] = sub_data
837840 for sub_field_path in sub_field_paths :
838841 field_path = FieldPath .from_string (field_name )
839842 field_path .parts = field_path .parts + sub_field_path .parts
840843 field_paths .append (field_path )
841844 elif value is constants .SERVER_TIMESTAMP :
842- if split_on_dots :
843- transform_paths .append (FieldPath (* field_name .split ("." )))
844- else :
845- transform_paths .append (FieldPath .from_string (field_name ))
845+ transform_paths .append (top_level_path )
846846 else :
847847 actual_data [field_name ] = value
848- field_paths .append (FieldPath ( field_name ) )
848+ field_paths .append (top_level_path )
849849 if not transform_paths :
850850 actual_data = document_data
851851 return transform_paths , actual_data , field_paths
@@ -887,9 +887,9 @@ def pbs_for_set(document_path, document_data, merge=False, exists=None):
887887 document_path (str): A fully-qualified document path.
888888 document_data (dict): Property names and values to use for
889889 replacing a document.
890- option (optional[~.firestore_v1beta1.client.WriteOption] ): A
891- write option to make assertions / preconditions on the server
892- state of the document before applying changes .
890+ merge (bool ): Whether to merge the fields or replace them
891+ exists (bool): If set, a precondition to indicate whether the
892+ document should exist or not. Used for create .
893893
894894 Returns:
895895 List[google.cloud.firestore_v1beta1.types.Write]: One
0 commit comments