How to maintain emulator’s firestore data after relaunching emulator

If you restart firebase emulator, you will lose all of the data in the firestore. To keep the data, you need to export and import execution.

Export data

> firebase emulators:export ./firestore-snapshot

In my case, I’d export data in the same path already, so it warned me, and I overwrote it.

Import data

firebase emulators:start --import ./firestore-snapshot --inspect-functions

I’m using inspector for cloud function debugging, so if you not, just ignore the last part ‘ — inspect-functions’

Just you need to do is adding this after the emulators:start command.

--import [path]

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store