-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
I found out that writing transforms, for example increments, on an empty doc stores the actual objects in the in-memory db, e.g.
# some code writing to the db
print(db.collection("users").document("user_one").get().to_dict())
{'num_matches_joined': <google.cloud.firestore_v1.transforms.Increment object at 0x10f2e8250>, 'scores': {'number_of_scored_games': <google.cloud.firestore_v1.transforms.Increment object at 0x10f2e8b50>, 'total_sum': <google.cloud.firestore_v1.transforms.Increment object at 0x10f2e87c0>}, 'potm_count': <google.cloud.firestore_v1.transforms.Increment object at 0x10f2e8be0>, 'record': {'num_win': <google.cloud.firestore_v1.transforms.Increment object at 0x10f2e8b20>, 'num_draw': <google.cloud.firestore_v1.transforms.Increment object at 0x10f2e8700>, 'num_loss': <google.cloud.firestore_v1.transforms.Increment object at 0x10f2e8d60>}, 'last_date_scores': {'20230503143043': 2.5}}
if instead I populate the doc before
db.collection("users").document("user_one").set({"name": "a"})
# some code writing to the db
print(db.collection("users").document("user_one").get().to_dict())
{'name': 'user_one', 'num_matches_joined': 1, 'scores': {'number_of_scored_games': 1, 'total_sum': 2.5}, 'potm_count': 0, 'record': {'num_win': 1, 'num_draw': 0, 'num_loss': 0}, 'last_date_scores': {'20230503143138': 2.5}}
Metadata
Metadata
Assignees
Labels
No labels