How do I authenticate as admin from the command line to dump out / query the data in my firestore? Example, I have a users
collection where each document looks like:
{
edit_count: 15
}
I simply want to print all these documents as json in my terminal.
I've used firebase-tools, but it looks like it's only supporting querying of the RTDB?
How to get query data using firebase firestore? Simply, use a get() call! query. get().
A DocumentSnapshot contains data read from a document in your Cloud Firestore database. The data can be extracted with the getData() or get(String) methods. If the DocumentSnapshot points to a non-existing document, getData() and its corresponding methods will return null .
While waiting for firebase-tools to support more firestore commands, I wrote a basic firestore client that you might find useful:
https://github.com/sgarciac/fuego
At the moment (July 2018) Firebase CLI supports database commands (get, set, push etc etc) only for the Realtime Database probably due to Firestore beeing in beta.
Hopefully it will support it later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With