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.
This question concerns the Firestore database, but, more generally, it concerns making async requests in parallel. Simply put, I wish to update multiple Firestore documents as quickly and efficiently as possible by mapping over an array of their document IDs. the .set() method is async (returning a promise) and so I understand that I can wrap the multiple requests – i.e. the map() – in a Promise.all() function, which will return a single promise once all of the requests have resolved. However, it is not at all clear to me whether I should await the set() within the map(). Whichever
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()
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
Here’s a picture of my data: I’m trying to get that document. This works: It returns: I.e., if I know the document’s key I can get the document. This doesn’t work: It just returns No such document! What’s wrong with my query? Answer The difference in your two requests is that in the first case you are retrieving one document which gives you a DocumentSnapshot which has the exists property and the data() method. In the second case you do a query, which gives you a QuerySnapshot that has to be handled differently from a DocumentSnapshot. Instead of a single