When using the firebase CLI with a Realtime Database I can use a command like this one to read a collection:
% firebase database:get DB_Path
But I can't find a way to select only the documents I need.
I have a hard time to believe that it could be impossible.
Something like:
% firebase database:get DB_Path where (name='Biden Joe')
Is there a proper syntax to do that ?
To learn the options for the database:get
command, run firebase database:get --help
as in:
% firebase database:get --help
Usage: firebase database:get [options] <path>
fetch and print JSON data at the specified path
Options:
-o, --output <filename> save output to the specified file
--pretty pretty print response
--shallow return shallow response
--export include priorities in the output response
--order-by <key> select a child key by which to order results
--order-by-key order by key name
--order-by-value order by primitive value
--limit-to-first <num> limit to the first <num> results
--limit-to-last <num> limit to the last <num> results
--start-at <val> start results at <val> (based on specified ordering)
--end-at <val> end results at <val> (based on specified ordering)
--equal-to <val> restrict results to <val> (based on specified ordering)
--instance <instance> use the database <instance>.firebaseio.com (if omitted, use default database instance)
-h, --help output usage information
So you can get all child nodes of your name with:
firebase database:get /users --order-by "name" --equal-to "Michael"
Don't forget to define an index for "name" in your rules.