Search code examples
firebasefirebase-realtime-databasefirebase-cli

firebase database:update from CLI - multiple database in one project


My firebase project has multiple real-time databases (RTDB). How can I use the command line interface (CLI) to update a specific database when I have more than one?

$ firebase database:update --help

  Usage: database:update [options] <path> [infile]

  update some of the keys for the defined path in your Firebase

  Options:

    -d, --data <data>  specify escaped JSON directly
    -y, --confirm      pass this option to bypass confirmation prompt
    -h, --help         output usage information

I choose my project with firebase use -add but there is nothing in the help page about defining the URL to the database, similar to this question. Both the node.js firebase-import and the python firebase-streaming-import include the database URL as a parameter.


Solution

  • It turns out that support for this was released today in version 3.19.0. firebase database:get --help now reports:

    --instance <instance>    use the database <instance>.firebaseio.com (if omitted, use default database instance)
    

    So, you should be able to use that to specify the shorthand instance name of your database.