add fields mod
This commit is contained in:
@@ -3,20 +3,25 @@ from firebase_admin import credentials, firestore
|
||||
import os
|
||||
from google.cloud.firestore_v1.base_query import FieldFilter
|
||||
|
||||
key_path = os.getcwd() + '/keys/hpos-af3cc-firebase-adminsdk.json'
|
||||
key_path = os.getcwd() + '/keys/hpos-prod-firebase-adminsdk.json'
|
||||
cred = credentials.Certificate(key_path)
|
||||
firebase_admin.initialize_app(cred)
|
||||
def update_incubation(source_collection):
|
||||
db = firestore.client()
|
||||
|
||||
docs = db.collection(source_collection).where(filter = FieldFilter("_id", "==", "207296063672UTKLSP3")).stream()
|
||||
docs = db.collection(source_collection).where(filter = FieldFilter("_id", "in", ['"565790365511BHAS N"','" 721968131392GAUS N "'])).stream()
|
||||
|
||||
for doc in docs:
|
||||
doc_id = doc.id #doc.to_dict()["_id"]
|
||||
print(doc_id)
|
||||
|
||||
try:
|
||||
db.collection(source_collection).document(doc_id).update({"testStatus": False, "incubationTime": "2023-10-12 9:29:00"})
|
||||
db.collection(source_collection).document(doc_id).update({
|
||||
# "bloodGroup": "B+",
|
||||
"testStatus": False,
|
||||
# "createdAt": "2023-11-11 07:05:00",
|
||||
"incubationTime": "2023-12-08 14:05:00",
|
||||
"incubationModified": True
|
||||
})
|
||||
print(f"Document with ID '{doc_id}' updated")
|
||||
except Exception as e:
|
||||
print(f"Error updating document with ID '{doc_id}' from the source collection: {e}")
|
||||
|
||||
Reference in New Issue
Block a user