Category : google-cloud-firestore

I am writing a python code connected to google firestore. I want my code to skip and not create a document if the document’s id is 1 if docid == 1: **do not create document** else: db.collection(u’collection_of_work’).document(docid).set(data) how to "not create" a document Source: Python..

Read more

I am trying to update my firestore collection with a list of strings from python. My list: results = [‘link1′,’link2′] My Firestore document is 01 Collection in document is as follow: links (map) —-> List_of_all_links (array)—-> this list should have 2 strings 0:link1 1:link2 SINCE i am coding using python, I added this : db.collection(u’myjob’).document(u’01’).update(results) ..

Read more

I’m using firebase firestore database for my KivyMD project. In the program when a button is pressed the data should be saved in the database if they doesn’t exist. It work successfully. But the problem is a ValueError is appeared when the user enters an existing email address and enter another email at second time ..

Read more

I am using firestore with python to write cloud functions. I need to test a function with following query: from google.cloud import firestore MY_COLLECTION_GROUP = firestore.Client(project="my-project").collection_group("my_collection") def function_to_test(data): my_query = ( MY_COLLECTION_GROUP.where("eventDateTime", "==", data["dateTime"]) .where("user.id", "==", data["user_id"]) .where("user.age", ">=", data["valid_age"]) ) # fetch results from query and proceed further To test the above function, I ..

Read more

I am getting error ‘Credentials’ object has no attribute ‘Certificate’. I already tried to reinstall the firebase_admin package. Traceback (most recent call last): File "main.py", line 29, in <module> cred = credentials.Certificate(‘./FStoreCredential/credentials.json’) AttributeError: ‘Credentials’ object has no attribute ‘Certificate’ Source: Python..

Read more

I must be doing something wrong I’m trying to loop through all documents in a collection and add the contents to a dictionary. I added the data to a dictionary, but my intention was to loop through all docs: query = blog_col.order_by("date").limit_to_last(4).get() for doc in query: # <–Doesn’t loop through all docs db_title=doc.to_dict()["title"] db_date=doc.to_dict()["date"] db_link=doc.to_dict()["link"] ..

Read more

Hey there i need to Pagenate this code can you guys please help me out i tried the docs but not able to get hold of it. cases = db.collection(u’hospitals’).document(request.session[‘hospital_email’]).collection(‘cases’).where( u’status’, u’==’, "done").where("formstatus", "==", "draft").order_by(u’date’).limit(3).get() for i in cases: cases_data[i.id] = i.to_dict() print(cases_data[i.id], " ==>", i.to_dict()) print("") Source: Python..

Read more