How to save all the documents name(document IDs) from a particular collection on a firebase into .txt file using javascript. The .txt file should be updated every-time when we execute the javascript.
Asked
Active
Viewed 52 times
-2
-
What you describe seems possible? But what have you tried?? Can you give more details on your attempts and the context (language, server? ...). β Renaud Tarnec Mar 18 '21 at 08:48
-
Hey! @RenaudTarnec thank you for your time!!.. I have updated my question, Thank you β Deekshith Xetty Mar 18 '21 at 14:30
-
Please take a moment and review [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). Itβs a good idea to include code and structures as *text*, not links and images. That way, if they are needed in an answer, they can be copied and pasted. Also, if the links break, it would invalidate the question. β Jay Mar 18 '21 at 20:09
1 Answers
0
As was answered in previous posts, Get Only documents names in Firestore [duplicate], you can use REST API list call to return documents' names from a specific collection.
Here is an example that lists documents of a collection and saves it to a text file (docs.txt):
curl GET "https://firestore.googleapis.com/v1beta1/projects/{project-ID}/databases/(default)/documents/{collection-name}" > docs.txt
You need to replace the {project-ID} with your project ID in Firestore and {collection-ID} with your collection name respectively.
Farid Shumbar
- 1,295
- 2
- 10