27
votes

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?

3
Yup as mentioned in answers due to firestore being in beta, the feature you're looking doesn't exist at the moment. A workaround for now would be to apply filters (which uses queries underneath) in the firebase console. Although this cannot perform complex queries at the moment. - Adarsh

3 Answers

12
votes

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.

10
votes

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

-10
votes

Read the documentation here: https://firebase.google.com/docs/admin/setup

This will teach you how to set up local auth to your firestore data.