How to delete all files in a firebase storage directory

I have a firebase storage path that looks like this. firebase.storage().ref(‘temp/test’) the “test” folder has about 25-50 files. I know there is not a way to delete the whole directory in firebase but Is there a way to iterate through all the files in a directory and deleting them one by one? Answer Is there a way to iterate through all the files in a directory and deleting them one by one? Yes, you can use the listAll() method, as follows: Note that: This method is only available for Firebase Rules Version 2 (add rules_version = ‘2’; at the top

Why does one code give me the right key from firebase and the other does not?

I’ve been working on a simple card catalog project that takes input from a form and displays it on a card. On each card is the option to remove the card completely, or check/uncheck a box. In order to do this, I need to access the object in the firebase real-time database. Each object is created by a .push() and generates a random key name, and I would like to access this key name to make changes in the object or remove it. I read up on the documentation at https://firebase.google.com/docs/database/web/read-and-write, and it provides a way to get the key

Not able to retrieve data from firebase firestore

I am saving data to firebase successfully But when i try to retrieve it firestore sends “No such document”. Trying to get the array of objects. Here is the db Edit: I found out that in order to access all documents you have to do it this way. It goes into the then block but then querySnapshot.forEach doesnt run Answer Okay so i found the solution.

How to push to a child node while updating values in the parent node Firebase RealTime

I am trying to update the values in the parent node of a firebase realtime db while simultaneously pushing data to a child node, however I get the error “Reference.update failed: First argument contains a path /xyz that is ancestor of another path /xyz/…/…” And my data is structured as so: Answer Your updates contains these two keys: It helps to realize that the Realtime Database processes a multi-location update as a list of set statements. So the first line sets a value to a deep key under ${ticker}, and then the second line sets a value to ${ticker}. This

can I get some documents from firestore simultaneously using Promise.all?

I want to get some documents from Firestore. in my callable cloud function, instead of waiting getting document one by one, await one by one, I use Promise.all so I can get all documents faster, like this and then I want to loop the document snapshots I just get, and here is the problem I have an error TypeError: Cannot read property ‘forEach’ of undefined what is wrong in here ? what should I do to get the documents that I just get from Firestore ? Answer The get() method returns a Promise that resolves with a QuerySnapshot. Since Promise.all()

How to update a value in multiples collections at once in firestore?

I’m building a forum appin Vue, basically a clone of this same site… The user can post questions, get answers to those questions and comments to those answers. I have a top level collection for questions, answers and comments respectively, and each document in those collections have a field called photoURL where I store the url of the profile image of the author of that question/answer/comment. Now, I have this code to update the photoURL field in each document from the same author in the three collections when a user update their profile image: It currently works, but there is

Firebase not working on script but on main html it does (Javascript)

after pasting the given data of my database, doing retrieves correctly the data and its shown as i want, but making a function on a index.js gives me this error Uncaught ReferenceError: data is not defined at extend (index.js:59) at index.js:61 I dont get why it would work outside the function and not inside, given that window.db is a global instance, i’ve tried a couple of ways differently without success, would somebody help me? 🙂 Answer The variable data is not defined in the extend() function (unless it’s some global variable, extend()). You’ll get better results if you refactor your

uploading and downloading storage images in firebase with VueJs

im building this simple application using Vue/vuex and firebase where i want to facilitate users upload images and once the app gets updated those images get reached from firebase storage , modifying the current database with the new uploaded image Here is my code: the images get push to the firebase storaged but once i try to modify the database adding this new element (image) using downloadUrls, doesnt work. Any advice please?….thanks in advance!!! Answer You need to use the getDownloadURL() method from the JavaScript SDK, which is asynchronous and returns a Promise that resolves with the download URL. So,

Accessing Geopoints using Firebase Cloud Functions?

I have a collection called posts in Firestore which contains a documents with the fields content and location. Content is a string and Location is a Geopoint. When accessing the database using Firebase Cloud Functions, I am able to print out the content by adding it into an array and JSON.stringfy the whole thing as a response. However, If i try to emulate this with the geopoints, I simply get an empty response {}. How do access the Geopoint values in the Firestore using Javascript so I can perform operations on/print them? i.e. find distance between two points. Answer I

Firebase database – filtering and ordering query

I’m working on a React Native app, and trying to set up a user research in the database, based on a given text. Here is my request code : Database looks like : The query returns what I want, but I have an error on each query only saying “@firebase/database:”. And nothing else… How can I fix it? Answer Most likely it is a warning about no index. Try adding an index to your data. You can do that by adding the following to the database.rules.json file: And deploying. Or by editing the rules in the Firebase Console. As described