# Restore Google Cloud Firestore data

You can restore Google Cloud Firestore content to recover from deletion or corruption. You can restore content to the same location (in place) or to a different Google Cloud Firestore database (out of place).

## Restore destinations

Destination | When to use
--- | ---
In place | Recovering from accidental deletion, corruption, or ransomware on the original Google Cloud Firestore database
Out of place | Migration, disaster recovery to a new database, or restoring to a test or sandbox database

## Permissions and prerequisites

For out-of-place restore to a different GCP project or database:

- The target Firestore database must be pre-created in the destination GCP project. The workload does not create Firestore databases.

- The Service Account must have `roles/datastore.importExportAdmin` and `roles/storage.objectAdmin` permissions on both the source (for reading backup data) and destination (for importing data) projects.

- The original GCS bucket where the backup was stored must remain accessible during restore.

Restore in place

You can restore Google Cloud Firestore content to the original location.

1. From the Command Center navigation pane, go to Protect > AI & Analytics.

2. Click the Google Cloud Firestore configuration.

3. On the Instances tab, click the action button , and then click Restore.

4. Select the recovery point (backup job) to restore from.

5. Select the collections to restore. To restore all collections, select the database level.

6. Verify that the restore destination is set to In place (same database).

7. Click Submit.

8. Monitor the restore job progress in the Jobs view.

Restore out of place

You can restore Google Cloud Firestore content to a different Google Cloud Firestore database and a path other than the original backup location.

1. From the Command Center navigation pane, go to Protect > AI & Analytics.

2. Click the Google Cloud Firestore configuration.

3. On the Instances tab, click the action button , and then click Restore.

4. Select the recovery point (backup job) to restore from.

5. Select the collections to restore. To restore all collections, select the database level.

6. Select Out of place.

7. In the Destination project field, enter the target GCP project ID.

8. In the Destination database field, enter the target Firestore database name. This database must exist in the destination project.

9. Click Submit.

10. Monitor the restore job progress in the Jobs view.

Restore proceeds in parent-first order:

- Collection data is restored first using Firestore `importDocuments` API (one import operation per collection or one combined import for all collections, depending on granular mode)

- Composite indexes are restored after all collection data is imported

- If a composite index already exists in the destination database, the HTTP 409 error is silently skipped

## Restore notes

- Document `create_time` and `update_time` fields are managed by Firestore and are not restored from the backup. These fields are set to the restore time.

- Existing documents with the same document ID are overwritten by the restore operation (upsert behavior).

- The restore uses the backup path stored in the job metadata to locate the GCS export prefix, so the original GCS bucket must remain accessible during restore.

- Firestore allows only 1 concurrent export or import operation per database at a time. If an import operation is already running on the destination database, the restore job waits or fails.

×

Loading...