Skip to content

Commit 34fce0e

Browse files
committed
docs(firestore): add pipelines overview and SDK compatibility pages
Introduce user-facing Firestore Pipelines documentation: overview with Enterprise requirements, platform notes, upstream links, findNearest vector search example, and firebase-js-sdk parity table. Add sidebar entries under Cloud Firestore. Fix broken okf-bundle and /reference links in existing docs. Ignore agent audit reports under .agents/reports/.
1 parent cbe2593 commit 34fce0e

9 files changed

Lines changed: 286 additions & 5 deletions

File tree

.agents/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
reports

.spellcheck.dict.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ authenticator
2323
AuthSettings
2424
autolinking
2525
Autolinking
26+
allowlist
2627
AVD
2728
axios
2829
Axios
@@ -39,17 +40,21 @@ callables
3940
CarPlay
4041
CDN
4142
Changelog
43+
changelogs
4244
checkForUpdate
4345
CLI
4446
CocoaPods
4547
codebase
48+
composable
4649
config
4750
Config
4851
config-plugin
4952
CP-User
5053
crashlytics
5154
Crashlytics
5255
CustomProvider
56+
deduplicate
57+
Deduplicate
5358
datastore
5459
debugToken
5560
DebugView
@@ -82,6 +87,8 @@ FirebaseApp
8287
FirebaseCore
8388
firestore
8489
Firestore
90+
geospatial
91+
Geospatial
8592
freeform
8693
GDPR
8794
GDPR-compliant
@@ -100,6 +107,7 @@ IDFA
100107
Imagen
101108
installable
102109
integrations
110+
interop
103111
Intellisense
104112
IntelliSense
105113
interstitials
@@ -191,6 +199,8 @@ screenview
191199
scrollable
192200
SDK
193201
SDK.
202+
subcollection
203+
Subcollection
194204
SDK51
195205
SDKs
196206
SDKs.

docs.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@
106106
{ "title": "Usage with Emulator", "href": "/firestore/emulator" },
107107
{ "title": "Usage with FlatLists", "href": "/firestore/usage-with-flatlists" },
108108
{ "title": "Implementing Pagination", "href": "/firestore/pagination" },
109+
{ "title": "Pipelines", "href": "/firestore/pipelines" },
110+
{
111+
"title": "Pipeline SDK compatibility",
112+
"href": "/firestore/pipelines/sdk-compatibility"
113+
},
109114
{
110115
"title": "Building a \"TODO\" app",
111116
"href": "https://invertase.io/blog/getting-started-with-cloud-firestore-on-react-native"

docs/firestore/pagination.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Pagination
33
description: Pagination example using Cloud Firestore.
4-
next: /functions/usage
4+
next: /firestore/pipelines
55
previous: /firestore/usage-with-flatlists
66
---
77

docs/firestore/pipelines/index.mdx

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
title: Pipelines
3+
description: Firestore pipeline queries in React Native Firebase - overview, requirements, and getting started.
4+
next: /firestore/pipelines/sdk-compatibility
5+
previous: /firestore/pagination
6+
---
7+
8+
Firestore **pipeline queries** let you run multi-stage read operations (filter, project, aggregate, vector search, and more) against Cloud Firestore using a fluent, composable API. React Native Firebase exposes the same modular pipeline surface as the [firebase-js-sdk](https://firebase.google.com/docs/reference/js/firestore_pipelines) so you can reuse patterns from web documentation and samples.
9+
10+
Pipeline support in React Native Firebase is marked **@beta** in TypeScript. APIs may evolve as Firebase ships new pipeline features.
11+
12+
<YouTube id="sYY1NweSlEc" />
13+
14+
# What are pipeline queries?
15+
16+
Traditional Firestore queries are collection-scoped and limited to a single query shape. **Pipelines** chain **stages** (for example `where`, `select`, `aggregate`, `findNearest`) on a **source** (collection, collection group, documents list, or an existing query). Each stage transforms the result of the previous stage.
17+
18+
Google's upstream resources:
19+
20+
- [Get started with pipeline queries](https://firebase.google.com/docs/firestore/pipelines/get-started-with-pipelines)
21+
- [firebase-js-sdk pipeline reference](https://firebase.google.com/docs/reference/js/firestore_pipelines)
22+
- [Introducing pipeline operations (Firebase blog, Jan 2026)](https://firebase.blog/posts/2026/01/firestore-enterprise-pipeline-operations/)
23+
24+
For a full list of which firebase-js-sdk exports are available in React Native Firebase today, see [SDK compatibility](/firestore/pipelines/sdk-compatibility).
25+
26+
# Requirements
27+
28+
## Firestore Enterprise edition
29+
30+
Pipeline `execute()` requires a **Firestore Enterprise** database. Standard edition databases reject pipeline execution. Create an Enterprise database in the Firebase console or with the Firebase CLI before testing pipelines in your project.
31+
32+
## Cloud execution (not the local emulator)
33+
34+
The Firestore emulator used for most React Native Firebase e2e tests runs in **Standard** edition mode and does **not** faithfully execute pipeline queries. Plan to develop and test pipelines against a **live Enterprise database** in your Firebase project.
35+
36+
The emulator may gain additional Enterprise pipeline support over time, but React Native Firebase pipeline integration tests today run against a dedicated cloud database (`pipelines-e2e` on the public testing project), not the local emulator.
37+
38+
# Installation
39+
40+
Pipelines ship inside `@react-native-firebase/firestore`. Install the app and Firestore modules as described in [Cloud Firestore usage](/firestore/usage):
41+
42+
```bash
43+
yarn add @react-native-firebase/app @react-native-firebase/firestore
44+
cd ios && pod install
45+
```
46+
47+
Expression helpers and types are imported from the pipelines entry point:
48+
49+
```js
50+
import { getFirestore } from '@react-native-firebase/firestore';
51+
import { field, constant, execute } from '@react-native-firebase/firestore/pipelines';
52+
```
53+
54+
You can also call `getFirestore().pipeline()` on any Firestore instance to start building a pipeline from a source stage.
55+
56+
# Basic example
57+
58+
This example reads documents from a collection, keeps rows where `score` is at least 10, projects two fields, and sorts by score descending. Adjust the database id and collection path for your Enterprise database.
59+
60+
```js
61+
import { getFirestore } from '@react-native-firebase/firestore';
62+
import { field, execute } from '@react-native-firebase/firestore/pipelines';
63+
64+
const db = getFirestore(); // use a named Enterprise database id if needed
65+
66+
const pipeline = db
67+
.pipeline()
68+
.collection('books')
69+
.where(field('score').greaterThanOrEqual(10))
70+
.select(field('title'), field('score'))
71+
.sort({ ordering: [{ fieldPath: 'score', direction: 'desc' }] });
72+
73+
const snapshot = await execute(pipeline);
74+
snapshot.results.forEach(row => {
75+
console.log(row.data());
76+
});
77+
```
78+
79+
`execute()` returns a `PipelineSnapshot` with a `results` array of pipeline rows. Iterate `snapshot.results` or access individual entries by index.
80+
81+
# Supported stages and sources
82+
83+
React Native Firebase supports these **source** types:
84+
85+
| Source | Description |
86+
| ----------------- | ---------------------------------------------------------------- |
87+
| `collection` | Documents in a collection path |
88+
| `collectionGroup` | Documents across a collection id |
89+
| `database` | Database-scoped pipeline source |
90+
| `documents` | Explicit document paths |
91+
| `query` | Pipeline created from an existing Firestore query (`createFrom`) |
92+
93+
These **stage** types are available on the pipeline builder:
94+
95+
| Stage | Purpose |
96+
| ---------------------------- | ------------------------------------------------ |
97+
| `where` | Filter rows |
98+
| `select` | Project fields |
99+
| `addFields` / `removeFields` | Add or drop computed fields |
100+
| `sort` | Order results |
101+
| `limit` / `offset` | Paginate |
102+
| `aggregate` | Group and reduce |
103+
| `distinct` | Deduplicate |
104+
| `findNearest` | Vector similarity search (requires vector index) |
105+
| `replaceWith` | Replace row shape |
106+
| `sample` | Random sample |
107+
| `union` | Combine pipelines |
108+
| `unnest` | Expand array fields into rows |
109+
110+
## Vector search with `findNearest`
111+
112+
The `findNearest` stage runs vector similarity search over an indexed embedding field. Use the same **lowercase** `distanceMeasure` values as the [firebase-js-sdk pipeline reference](https://firebase.google.com/docs/reference/js/firestore_pipelines): `'euclidean'`, `'cosine'`, or `'dot_product'`.
113+
114+
Create a [vector index](https://firebase.google.com/docs/firestore/pipelines/get-started-with-pipelines) on your Enterprise database before running this query.
115+
116+
```js
117+
import { getFirestore } from '@react-native-firebase/firestore';
118+
import { execute } from '@react-native-firebase/firestore/pipelines';
119+
120+
const db = getFirestore(); // Enterprise database with a vector index on `embedding`
121+
122+
const queryVector = [1.0, 0.0, 0.0];
123+
124+
const snapshot = await execute(
125+
db
126+
.pipeline()
127+
.collection('products')
128+
.findNearest({
129+
field: 'embedding',
130+
vectorValue: queryVector,
131+
distanceMeasure: 'euclidean',
132+
limit: 5,
133+
})
134+
.select('name'),
135+
);
136+
137+
snapshot.results.forEach(row => {
138+
console.log(row.data().name);
139+
});
140+
```
141+
142+
Newer firebase-js-sdk stage helpers such as `subcollection` and `parent` are not yet exposed — see [SDK compatibility](/firestore/pipelines/sdk-compatibility).
143+
144+
# Platform notes
145+
146+
| Platform | Runtime | Notes |
147+
| ----------- | ----------------------------- | ---------------------------------------------------------------------------- |
148+
| **Android** | Native Firebase Android SDK | Full native pipeline execution |
149+
| **iOS** | Native Firebase iOS SDK | Some expression helpers are not yet supported on iOS; see compatibility page |
150+
| **macOS** | firebase-js-sdk (web interop) | Same API shape as web; requires network access to Firestore |
151+
152+
On **iOS**, pipelines that use unsupported expression functions fail before execution with a clear error listing the function names. The compatibility page lists the current set.
153+
154+
On **macOS**, pipeline execution goes through the web Firebase SDK bundled for React Native macOS targets. Behavior should match web pipeline queries for the same database and rules.
155+
156+
# TypeScript
157+
158+
Pipeline types and expression helpers are exported from `@react-native-firebase/firestore/pipelines`. The `firestore.pipeline()` method is augmented on `Firestore` when you import the firestore module.
159+
160+
Run `yarn compare:types` in the React Native Firebase repository to see tracked differences between our public types and the firebase-js-sdk pipelines declarations.
161+
162+
# Next steps
163+
164+
- Review [SDK compatibility](/firestore/pipelines/sdk-compatibility) before porting firebase-js-sdk pipeline samples.
165+
- Read Firebase's [get started guide](https://firebase.google.com/docs/firestore/pipelines/get-started-with-pipelines) for index setup, vector search, and security rules considerations.
166+
- For classic collection queries, continue with [Cloud Firestore usage](/firestore/usage).
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: Pipeline SDK compatibility
3+
description: How React Native Firebase Firestore pipelines compare to the firebase-js-sdk pipelines API.
4+
next: /functions/usage
5+
previous: /firestore/pipelines
6+
---
7+
8+
React Native Firebase aims to be a **drop-in replacement** for the [firebase-js-sdk Firestore pipelines module](https://firebase.google.com/docs/reference/js/firestore_pipelines) on React Native targets. Most expression helpers, stage builders, and types match the JS SDK. This page summarizes deliberate gaps so you can plan migrations from web samples.
9+
10+
CI enforces parity through `yarn compare:types` and the `firestore-pipelines` allowlist in the repository. When a gap closes, the allowlist entry is removed and this page should be updated.
11+
12+
# Summary
13+
14+
| Category | Status |
15+
| --------------------------------------------------------------------------- | --------------------------------------------------------------------- |
16+
| Core pipeline builder (`pipeline()`, stages, `execute()`) | **Supported** on Android, iOS, and macOS |
17+
| Expression helpers (aggregates, strings, arrays, maps, timestamps, vectors) | **Mostly supported** — see gaps below |
18+
| Newer firebase-js-sdk helpers (2025–2026) | **Partial** — tracked in "Not yet available" |
19+
| firebase-js-sdk `Type` export | **React Native Firebase only** — use `isType()` with our `Type` union |
20+
21+
# Not yet available in React Native Firebase
22+
23+
These firebase-js-sdk pipeline exports are **not** exposed yet. They are listed in the repository compare-types allowlist until implemented:
24+
25+
| Export | Kind | Notes |
26+
| --------------------------- | ---------- | ------------------------------ |
27+
| `coalesce` | Expression | Null-coalescing helper |
28+
| `currentDocument` | Expression | Document context helper |
29+
| `documentMatches` | Expression | Document matching helper |
30+
| `geoDistance` | Expression | Geospatial distance |
31+
| `ifNull` | Expression | Null handling |
32+
| `score` | Expression | Full-text search score |
33+
| `switchOn` | Expression | Conditional switch |
34+
| `timestampDiff` | Expression | Timestamp arithmetic |
35+
| `timestampExtract` | Expression | Timestamp field extraction |
36+
| `subcollection` | Stage | Subcollection source stage |
37+
| `parent` | Stage | Parent document stage |
38+
| `DefineStageOptions` | Type | Options for define stage |
39+
| `SearchStageOptions` | Type | Full-text search stage options |
40+
| `SubcollectionStageOptions` | Type | Subcollection stage options |
41+
| `TimePart` | Type | Timestamp extraction part |
42+
| `TimeUnit` | Type | Timestamp unit |
43+
44+
If you depend on one of these, follow [Firebase pipeline release notes](https://firebase.google.com/support/release-notes/js) and React Native Firebase changelogs, or open a feature request with your use case.
45+
46+
# Same name, slightly different shape
47+
48+
These exports exist in both SDKs but differ in typing or optional parameters:
49+
50+
| Export | Difference |
51+
| ----------------- | --------------------------------------------------------------------- |
52+
| `constant` | firebase-js-sdk added optional `preferIntegers`; not yet on RNFB |
53+
| `isType` | RNFB accepts the local `Type` alias; JS SDK accepts a broader string |
54+
| `ExpressionType` | JS SDK includes newer `PipelineValue` kind |
55+
| `StageOptions` | Equivalent runtime shape; declaration formatting differs |
56+
| `TimeGranularity` | RNFB uses `isoWeek` / `isoYear`; JS SDK also lists lowercase variants |
57+
58+
# React Native Firebase only
59+
60+
| Export | Notes |
61+
| ------ | ----------------------------------------------------------------------- |
62+
| `Type` | Local type discriminator union used with `isType()` and related helpers |
63+
64+
# iOS expression limitations
65+
66+
Even when an expression helper is exported from `@react-native-firebase/firestore/pipelines`, the **iOS native runtime** may not implement it yet. Using these functions in a pipeline on iOS throws before `execute()` completes:
67+
68+
| Function | Status on iOS |
69+
| ------------------- | ------------- |
70+
| `arrayGet` | Not supported |
71+
| `conditional` | Not supported |
72+
| `round` | Not supported |
73+
| `stringRepeat` | Not supported |
74+
| `substring` | Not supported |
75+
| `timestampAdd` | Not supported |
76+
| `timestampSubtract` | Not supported |
77+
| `trunc` | Not supported |
78+
79+
**Android** and **macOS** do not apply this check; macOS uses the web SDK path. Prefer testing pipeline samples on Android or macOS when they use the functions above until iOS parity lands.
80+
81+
The list is defined in `packages/firestore/lib/pipelines/pipeline_support.ts` and kept in sync with `RNFBFirestorePipelineNodeBuilder.swift`.
82+
83+
# Platform execution matrix
84+
85+
| Platform | Execution backend | Pipeline database |
86+
| -------- | ------------------------------- | ------------------ |
87+
| Android | Native Android Firestore SDK | Enterprise (cloud) |
88+
| iOS | Native iOS Firestore SDK | Enterprise (cloud) |
89+
| macOS | firebase-js-sdk via web interop | Enterprise (cloud) |
90+
91+
All platforms require network access to your Firestore Enterprise database for pipeline `execute()`. The local Firestore emulator is not a supported target for pipeline development today.
92+
93+
# Staying up to date
94+
95+
- Upstream API reference: [firebase-js-sdk `firestore/pipelines`](https://firebase.google.com/docs/reference/js/firestore_pipelines)
96+
- RNFB import path: `@react-native-firebase/firestore/pipelines`
97+
- Repository parity config: `.github/scripts/compare-types/configs/firestore-pipelines.ts`
98+
99+
When a row in the tables above is resolved in a release, it will be removed from the compare-types allowlist. Check release notes and this page after upgrading `@react-native-firebase/firestore`.

docs/functions/usage/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Cloud Functions
33
description: Installation and getting started with Cloud Functions.
44
next: /functions/writing-deploying-functions
5-
previous: /firestore/pagination
5+
previous: /firestore/pipelines/sdk-compatibility
66
---
77

88
# Installation

docs/migrating-to-v25.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ await initializeAppCheck(getApp(), {
410410

411411
Version 25 aligns `@react-native-firebase/auth` TypeScript types with the firebase-js-sdk modular API. Runtime behavior is largely unchanged, but TypeScript consumers should review the following breaking changes.
412412

413-
For maintainers and coding agents: the living triage matrix is [`okf-bundle/packages/auth/compare-types-triage.md`](../okf-bundle/packages/auth/compare-types-triage.md). Run `yarn compare:types auth` after public API edits and update `.github/scripts/compare-types/configs/auth.ts` when differences are intentional.
413+
For maintainers and coding agents: the living triage matrix is [`okf-bundle/packages/auth/compare-types-triage.md`](https://github.com/invertase/react-native-firebase/blob/main/okf-bundle/packages/auth/compare-types-triage.md). Run `yarn compare:types auth` after public API edits and update `.github/scripts/compare-types/configs/auth.ts` when differences are intentional.
414414

415415
## Platform matrix (read before changing Auth)
416416

docs/typescript.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Published types are built to `packages/<module>/dist/typescript/` (for example `
4141

4242
Modular Auth source: [`packages/auth/lib/modular.ts`](https://github.com/invertase/react-native-firebase/blob/main/packages/auth/lib/modular.ts).
4343

44-
Public API reference (generated from source JSDoc): [reference API](/reference).
44+
Public API reference (generated from source JSDoc): [reference API](https://reference.rnfirebase.io/modules.html).
4545

4646
## Definitions per module
4747

@@ -53,4 +53,4 @@ Each package exports its own types from the package root. Examples:
5353
| Firestore | `FirebaseFirestoreTypes` namespace (namespaced) + modular helpers from `@react-native-firebase/firestore` |
5454
| App Check | `AppCheck`, `AppCheckTokenResult`, … |
5555

56-
For Auth v25 alignment details and intentional firebase-js-sdk differences, see the [Auth compare:types triage](../okf-bundle/packages/auth/compare-types-triage.md) knowledge document and [`yarn compare:types auth`](https://github.com/invertase/react-native-firebase/blob/main/.github/scripts/compare-types/configs/auth.ts) registry.
56+
For Auth v25 alignment details and intentional firebase-js-sdk differences, see the [Auth compare:types triage](https://github.com/invertase/react-native-firebase/blob/main/okf-bundle/packages/auth/compare-types-triage.md) knowledge document and [`yarn compare:types auth`](https://github.com/invertase/react-native-firebase/blob/main/.github/scripts/compare-types/configs/auth.ts) registry.

0 commit comments

Comments
 (0)