MongoDB: In n8n Credentials, create a "MongoDB" credential. Enter your MongoDB Atlas connection string: mongodb+srv://username:password@cluster.mongodb.net/dbname. The native MongoDB node supports Find, Insert, Update, Delete, and Aggregate operations.
Firebase Firestore: Download your Firebase service account JSON from Firebase Console → Project Settings → Service Accounts. Create an "HTTP Request" credential with the service account details. Use Google's Firestore REST API: https://firestore.googleapis.com/v1/projects/PROJECT_ID/databases/(default)/documents/COLLECTION. For n8n Cloud, use the native "Google Firebase Firestore" node if available, or the HTTP Request approach with a service account JWT.
Google Sheets: Use the native "Google Sheets" node with OAuth2 authentication. This is the simplest setup — just connect your Google account and select the spreadsheet. The Sheets node supports Read, Append, Update, and Delete row operations.
Use case: Your CRM data lives in MongoDB. Your sales team tracks deals in Google Sheets. Keep them in sync automatically.
Set up a schedule trigger (every 30 minutes or every hour). Use the MongoDB Find node to get all documents updated in the last sync window: { updatedAt: { $gte: {{ new Date(Date.now() - 3600000).toISOString() }} } }
For each document, use a Google Sheets node in "Update Row" mode to find the matching row by a unique ID column and update it. If no matching row exists (new record), use an "Append Row" operation instead.
Use a Code node to track the sync state (timestamp of last successful sync) in a MongoDB "system_metadata" collection. This prevents re-processing records that didn't change.
Firebase doesn't push to n8n directly, but you can create a Firebase Cloud Function that sends a webhook to n8n when a document changes. Here's the Cloud Function pattern:
// Firebase Cloud Function (JavaScript)
exports.onDocumentWrite = functions.firestore
.document("orders/{orderId}")
.onWrite(async (change, context) => {
const newData = change.after.data();
await fetch("https://your-n8n.domain/webhook/firebase-order", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
orderId: context.params.orderId,
data: newData,
eventType: change.before.exists ? "updated" : "created"
})
});
});In n8n, the Webhook node receives this and triggers your processing workflow. This gives you true real-time Firebase → n8n integration.
Pattern: MongoDB aggregation → data transformation → Google Sheets report → email delivery.
Use the MongoDB node with an Aggregate operation to run your reporting query:
// MongoDB Aggregate Pipeline
[
{ "$match": { "createdAt": { "$gte": { "$date": "{{ startDate }}" } } } },
{ "$group": {
"_id": "$category",
"total_revenue": { "$sum": "$amount" },
"order_count": { "$count": {} },
"avg_order": { "$avg": "$amount" }
}},
{ "$sort": { "total_revenue": -1 } }
]The MongoDB node returns the aggregation results as n8n items. A Set node formats each item into the column structure your Google Sheet expects. The Google Sheets node appends all rows in a single operation using "Append or Update" mode.
When migrating data between databases (e.g., from Firebase to MongoDB, or from MySQL to Firebase), use n8n as the migration controller.
Use SplitInBatches node (batch size: 100) to process large datasets without timing out. Between batches, add a Wait node (2 seconds) to avoid overloading the target database.
Use a Code node to transform the source schema to the target schema — field renames, type conversions, nested structure flattening. Always validate transformed records before writing to the target.
Track migration progress in a MongoDB "migration_log" collection: record batch number, items processed, items failed, and timestamp. This lets you resume interrupted migrations without re-processing already-migrated records.
An e-commerce business stores orders in MongoDB, user sessions in Firebase, and the CEO reviews all KPIs in a Google Sheets dashboard. n8n keeps all three in sync and generates a daily email report automatically.