The Firestore Default Database Trap: Why Your Data Is Going to the Wrong Place
Firestore has a (default) database. If you don't explicitly specify which database to use, everything routes there. We had multiple Firestore databases in production, but several code paths were ac...

Source: DEV Community
Firestore has a (default) database. If you don't explicitly specify which database to use, everything routes there. We had multiple Firestore databases in production, but several code paths were accidentally hitting the default. This guide covers how Firestore's default database works, how to detect misrouting, and how to fix it in Python and JavaScript/React. The Problem: Silent Data Misrouting We use multiple Firestore databases for tenant isolation. Each evaluation tenant has its own database: evaluations-db-prod-tenant-1 evaluations-db-prod-tenant-2 evaluations-db-prod-tenant-3 ... evaluations-db-prod-tenant-12 But some code paths were missing explicit database references: # ❌ BAD: Routes to (default) database from google.cloud import firestore db = firestore.Client() # No database specified! db.collection("evaluations").add({"score": 0.95}) This code writes to (default), not the tenant-specific database. The bug was silent — no errors, just wrong data location. How Firestore Defau