google-cloud-firestore

Firestore collection documents accessible directly but not with stream()

Firestore collection documents accessible directly but not with stream() Question: I am using simple Firestore database with chats collection inside which each chat document has collection of message documents. If I want to access specific message I can do following request msg_ref = self.db.collection(‘chats’).document(chat_id).collection(‘messages’).document(msg_id) I can also access all of the messages for given chat …

Total answers: 1

How to access firebase database without having 'Realtime Database'? [python]

How to access firebase database without having 'Realtime Database'? [python] Question: Im trying to connect my python script to a Firebase database. Here is the code: import firebase_admin from firebase_admin import credentials, db cred = credentials.Certificate("irebase-adminsdk-ofcmd-bwd7fbcz2c.json") firebase_admin.initialize_app(cred, {‘databaseURL’:’https://company.firebaseio.com/’}) ref = db.reference(‘/users’).get() The ERROR Im facing looks like this: requests.exceptions.HTTPError: 404 Client Error: Not Found for …

Total answers: 1

Generating new HTML rows for each Document from firestore in python Django

Generating new HTML rows for each Document from firestore in python Django Question: I have a collection of documents in a Firestore database. I want to create a web form to display all the documents and their fields. I started by streaming all the documents using: docs = db.collection(u’users’).stream() and then appending all the docs …

Total answers: 1

Firestore Python SDK – count() aggregation

Firestore Python SDK – count() aggregation Question: I’m using Firebase Firestore in my Python project (with their official Python SDK) and having trouble performing count() aggregation. This funciton is supported according to their docs. However, they do not provide Python example ( they do in other parts of documentation ). I tried to play with …

Total answers: 2

Initializing 2 firebase apps in python

Initializing 2 firebase apps in python Question: As part of my project, I’ve made 2 different Firestore databases. Usually, when I work with 1, it sets up fine in my project file. Now that I’m implementing BOTH of them in my python file (running discord.py), it throws up an error! Here’s the code for reference: …

Total answers: 1

how to delete document without deleting collection in firestore?

how to delete document without deleting collection in firestore? Question: I want to create some kind of collection which cannot be deleted. The reason I made it like that is because when the document is empty my website can’t do the data creation process is it possible to create a collection in firestore that has …

Total answers: 1

Get number of documents in collection firestore

Get number of documents in collection firestore Question: Is it possible to count how many documents a collection in Firestore has, using python? I just found this code functions.firestore.document(‘collection/{documentUid}’) .onWrite((change, context) => { if (!change.before.exists) { // New document Created : add one to count db.doc(docRef).update({numberOfDocs: FieldValue.increment(1)}); } else if (change.before.exists && change.after.exists) { // …

Total answers: 2

Howto write a python-based firebase https function?

Howto write a python-based firebase https function? Question: I would like to call a backend function from my mobile app. However this backend function shall be written in python. This function shall be directly callable from my mobile app, it shall access firebase, do some computations and return the result (Ideally, only if the user …

Total answers: 2