Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions firestore-bigquery-export/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,21 @@ params:
default: info
required: true

- param: IGNORE_DOCUMENT_DELETION
label: Ignore Document Deletion
description: >-
If enabled, Firestore deleted document will not be exported (the Firestore
onDocumentDeleted event will be ignored). The reduction in data should be
more performant, and avoid potential resource limitations.
type: select
required: false
default: no
options:
- label: Yes
value: yes
- label: No
value: no

events:
# OLD event types for backward compatibility
- type: firebase.extensions.firestore-counter.v1.onStart
Expand Down
1 change: 1 addition & 0 deletions firestore-bigquery-export/functions/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ export default {
process.env.BACKUP_GCS_BUCKET || `${process.env.PROJECT_ID}.appspot.com`,
backupDir: `_${process.env.INSTANCE_ID || "firestore-bigquery-export"}`,
logLevel: process.env.LOG_LEVEL || LogLevel.INFO,
ignoreDocumentDeletion: process.env.IGNORE_DOCUMENT_DELETION === "yes" ? true : false,
};
11 changes: 10 additions & 1 deletion firestore-bigquery-export/functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,16 @@ export const fsexportbigquery = onDocumentWritten(
const fullResourceName = `projects/${projectId}/databases/${config.databaseId}/documents/${relativeName}`;
const eventId = context.id;
const operation = changeType;


if (config.ignoreDocumentDeletion && isDeleted) {
logs.logEventAction(
"Firestore event received and ignored by onDocumentWritten trigger",
fullResourceName,
eventId,
operation
);
return;
}
logs.logEventAction(
"Firestore event received by onDocumentWritten trigger",
fullResourceName,
Expand Down