Firebase is where a lot of startups store their data. It's fast to set up, scales automatically, and integrates neatly with web and mobile apps through the Firebase SDKs. Firestore, the document database at the center of the Firebase ecosystem, is particularly popular for apps that need real-time syncing and flexible data structures.
But here's the problem that hits almost every startup that grows past its initial stage: Firestore is great for building apps, but it's a poor fit for answering business questions. "How many users signed up this week?" "What's our most popular product?" "Which users haven't logged in for 30 days?"answering these requires either writing custom queries in the Firestore SDK, exporting data elsewhere, or paying an engineer to build a reporting layer.
This article explains how to query Firestore in plain English, what the limitations are, and when it makes sense to use an AI-powered interface instead of writing Firestore SDK queries yourself.
Why Firestore Queries Are Different
Firestore is a document database. Data is organized into collections of documents, where each document is a JSON-like object with fields. Unlike a relational database, there are no tables, no rows, andcriticallyno SQL.
To query Firestore, you use the Firebase SDK or REST API. A basic query looks like this in JavaScript:
const db = firebase.firestore();
const snapshot = await db
.collection("users")
.where("plan", "==", "pro")
.where("createdAt", ">=", new Date("2026-01-01"))
.orderBy("createdAt", "desc")
.get();
snapshot.forEach(doc => {
console.log(doc.id, doc.data());
});This works fine when you're building an app feature. But for ad-hoc business analysis, it has serious limitations:
No aggregations. Firestore doesn't support COUNT, SUM, AVG, or GROUP BY natively. To count documents matching a condition, you either maintain a counter document (which requires careful transaction logic) or fetch all matching documents and count them in your applicationwhich is expensive and slow on large collections.
No cross-collection joins. You can't query across two collections in a single operation. If your users are in one collection and their orders in another, you need multiple round-trips.
Composite indexes. Queries that filter on multiple fields require composite indexes, which must be created in advance. If you forget to create one, the query fails with an error.
No full-text search. Firestore has no built-in text search. Finding all users whose name contains "john" requires a third-party solution.
These limitations are by designFirestore is optimized for real-time sync and horizontal scale, not analytics. But they make it genuinely difficult to answer business questions directly from Firestore.
The Common Workarounds (and Their Costs)
Most teams reach for one of a few solutions when they outgrow Firestore's query limitations.
Export to BigQuery. Firebase has a built-in BigQuery export. Once enabled, your Firestore data streams to BigQuery, where you can write full SQL. This works well but adds latency (data is typically 1-24 hours behind), requires a BigQuery setup, and means your team now needs to know BigQuery SQL in addition to Firebase.
Export to PostgreSQL or Supabase. Some teams sync Firestore data to a relational database using Cloud Functions or a service like Fivetran. Again, this adds infrastructure complexity and sync delays.
Write custom Cloud Functions for reporting. You can write Firebase Cloud Functions that aggregate data and expose reporting endpoints. This gives you real-time data, but every new business question requires a new functionand an engineer to write it.
Use Firebase Extensions. Firebase has extensions for Algolia search, Stripe billing, and a few other integrations. But there's no general-purpose analytics extension.
Each of these approaches works, but they all require technical setup and ongoing maintenance. A non-technical user still can't just ask "how many active users do I have?" and get an answer.
How Natural Language Querying Works with Firestore Data
The most practical approach for teams who want plain-English access to their Firestore data is to connect through a database interface that understands the Firestore/Firebase data model.
Here's how a tool like AI for Database handles it:
For example, you might ask: "How many new users signed up in the last 7 days?"
Behind the scenes, the system queries your users collection filtered by createdAt timestamp, counts the results, and returns the number. You don't need to write a single line of code.
Or: "Show me all orders where the total is over $500 placed this month, sorted by amount."
// Generated query equivalent:
db.collection("orders")
.where("total", ">", 500)
.where("createdAt", ">=", startOfMonth)
.where("createdAt", "<", endOfMonth)
.orderBy("createdAt")
.orderBy("total", "desc")
.get()The tool handles the index requirements and pagination automatically.
Real Scenarios: What You Can Ask
Here are concrete examples of business questions that become easy with natural language Firestore access:
User analysis:
Order and revenue tracking:
Content or engagement data:
Operational queries:
Each of these would require a custom Cloud Function or BigQuery setup to answer without an AI interface. With one, you type the question and get the answer in seconds.
Connecting Firestore to AI for Database
Setting up the connection takes a few minutes:
Step 1: Create a service account.
In the Google Cloud Console (or Firebase Console), go to Project Settings → Service Accounts → Generate new private key. Download the JSON file.
Step 2: Add the connection in AI for Database.
Go to Connections, click Add Connection, and select Firebase / Firestore. Upload your service account JSON or paste the credentials. Specify your project ID and optionally the collections you want to make available.
Step 3: Start asking questions.
Once the connection is active, open the query interface and type your question. The tool introspects your collections and translates your question into the appropriate query.
If you've already set up BigQuery export from Firebase, you can also connect AI for Database directly to your BigQuery dataset instead. This gives you full SQL capabilities on your Firestore data with no additional setup beyond what you've already done.
Building Dashboards from Your Firestore Data
Beyond one-off questions, you can build self-refreshing dashboards from your Firestore collections. Instead of building a custom reporting view in your appwhich requires engineering time and a deploymentyou describe the charts you want:
AI for Database converts each description into a query, renders the chart, and refreshes it on whatever schedule you set. Share the dashboard link with your team and everyone stays on the same page without anyone needing Firebase access.
This is particularly useful for founder or investor reporting. Instead of pulling numbers manually every week, the dashboard just stays up to date.
Setting Up Automated Alerts on Firestore Data
Dashboards tell you what's happening. Alerts tell you when something needs attention.
With AI for Database's workflow feature, you can set conditions that trigger notifications when your Firestore data changes:
You describe the condition and the action in plain English, set a check frequency, and the system handles the rest. No Cloud Functions, no cron jobs, no custom notification infrastructure.