2

Whenever I start the emulator I have to import a database for the realtime database and sometimes make the top level collections manually for firestore.

Is there a way to setup the emulator, such that the databases are already ready?

I don't want this to be filled with all the data from the actual project but rather some dummy data that is suffficient to carry out local development.

Again, I am not asking for this setup to run tests, (as is mentioned here) but rather for daily development.

nsrCodes
  • 625
  • 10
  • 25

1 Answers1

5

If you want to import default data when the emulator starts, have a look at the documentation on importing and exporting data, which says:

You can export data from the Authentication, Cloud Firestore, Realtime Database and Cloud Storage emulators to use as a shareable, common baseline data set.

And the documentation for the --import flag:

--import=import_directory

Optional. Use with the Authentication, Cloud Firestore, Realtime Database or Cloud Storage emulator. Import data saved using the --export-on-exit startup option or the emulators:export command to a running Authentication, Cloud Firestore, Realtime Database or Cloud Storage emulator instance. Any data currently in emulator memory will be [overwritten].

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 1
    Edited the question to remove the stupid mistake. Will try using `--export-on-exit=` to export the next time I set things up manually and then add `--import` with the `firebase emulators:start`. Thanks :) – nsrCodes Jul 19 '21 at 05:51