Skip to content

How to get the documents name from a particular collection that present on a firebase/ firestore using shell script [closed]

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.

https://i.stack.imgur.com/qyn8H.png

Answer

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.