feat/pipelines to main (#9356)

This commit is contained in:
Mark Duckworth
2026-01-07 19:05:34 -07:00
committed by GitHub
parent 8e944db00b
commit d096720646
184 changed files with 66933 additions and 1180 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@firebase/firestore': minor
'firebase': minor
---
Release Firestore Pipelines for Enterprise edition in public preview.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+124
View File
@@ -597,6 +597,130 @@ toc:
path: /docs/reference/js/firestore_lite.vectorvalue.md
- title: WriteBatch
path: /docs/reference/js/firestore_lite.writebatch.md
- title: firestore/lite/pipelines
path: /docs/reference/js/firestore_lite_pipelines.md
section:
- title: AggregateFunction
path: /docs/reference/js/firestore_lite_pipelines.aggregatefunction.md
- title: AliasedAggregate
path: /docs/reference/js/firestore_lite_pipelines.aliasedaggregate.md
- title: AliasedExpression
path: /docs/reference/js/firestore_lite_pipelines.aliasedexpression.md
- title: BooleanExpression
path: /docs/reference/js/firestore_lite_pipelines.booleanexpression.md
- title: Bytes
path: /docs/reference/js/firestore_lite_pipelines.bytes.md
- title: CollectionReference
path: /docs/reference/js/firestore_lite_pipelines.collectionreference.md
- title: DocumentData
path: /docs/reference/js/firestore_lite_pipelines.documentdata.md
- title: DocumentReference
path: /docs/reference/js/firestore_lite_pipelines.documentreference.md
- title: DocumentSnapshot
path: /docs/reference/js/firestore_lite_pipelines.documentsnapshot.md
- title: Expression
path: /docs/reference/js/firestore_lite_pipelines.expression.md
- title: Field
path: /docs/reference/js/firestore_lite_pipelines.field.md
- title: FieldPath
path: /docs/reference/js/firestore_lite_pipelines.fieldpath.md
- title: FieldValue
path: /docs/reference/js/firestore_lite_pipelines.fieldvalue.md
- title: Firestore
path: /docs/reference/js/firestore_lite_pipelines.firestore.md
- title: FirestoreDataConverter
path: /docs/reference/js/firestore_lite_pipelines.firestoredataconverter.md
- title: FunctionExpression
path: /docs/reference/js/firestore_lite_pipelines.functionexpression.md
- title: GeoPoint
path: /docs/reference/js/firestore_lite_pipelines.geopoint.md
- title: Ordering
path: /docs/reference/js/firestore_lite_pipelines.ordering.md
- title: Pipeline
path: /docs/reference/js/firestore_lite_pipelines.pipeline.md
- title: PipelineResult
path: /docs/reference/js/firestore_lite_pipelines.pipelineresult.md
- title: PipelineSnapshot
path: /docs/reference/js/firestore_lite_pipelines.pipelinesnapshot.md
- title: PipelineSource
path: /docs/reference/js/firestore_lite_pipelines.pipelinesource.md
- title: Query
path: /docs/reference/js/firestore_lite_pipelines.query.md
- title: QueryDocumentSnapshot
path: /docs/reference/js/firestore_lite_pipelines.querydocumentsnapshot.md
- title: Selectable
path: /docs/reference/js/firestore_lite_pipelines.selectable.md
- title: StageOptions
path: /docs/reference/js/firestore_lite_pipelines.stageoptions.md
- title: Timestamp
path: /docs/reference/js/firestore_lite_pipelines.timestamp.md
- title: VectorValue
path: /docs/reference/js/firestore_lite_pipelines.vectorvalue.md
- title: firestore/pipelines
path: /docs/reference/js/firestore_pipelines.md
section:
- title: AggregateFunction
path: /docs/reference/js/firestore_pipelines.aggregatefunction.md
- title: AliasedAggregate
path: /docs/reference/js/firestore_pipelines.aliasedaggregate.md
- title: AliasedExpression
path: /docs/reference/js/firestore_pipelines.aliasedexpression.md
- title: BooleanExpression
path: /docs/reference/js/firestore_pipelines.booleanexpression.md
- title: Bytes
path: /docs/reference/js/firestore_pipelines.bytes.md
- title: CollectionReference
path: /docs/reference/js/firestore_pipelines.collectionreference.md
- title: DocumentData
path: /docs/reference/js/firestore_pipelines.documentdata.md
- title: DocumentReference
path: /docs/reference/js/firestore_pipelines.documentreference.md
- title: DocumentSnapshot
path: /docs/reference/js/firestore_pipelines.documentsnapshot.md
- title: Expression
path: /docs/reference/js/firestore_pipelines.expression.md
- title: Field
path: /docs/reference/js/firestore_pipelines.field.md
- title: FieldPath
path: /docs/reference/js/firestore_pipelines.fieldpath.md
- title: FieldValue
path: /docs/reference/js/firestore_pipelines.fieldvalue.md
- title: Firestore
path: /docs/reference/js/firestore_pipelines.firestore.md
- title: FirestoreDataConverter
path: /docs/reference/js/firestore_pipelines.firestoredataconverter.md
- title: FunctionExpression
path: /docs/reference/js/firestore_pipelines.functionexpression.md
- title: GeoPoint
path: /docs/reference/js/firestore_pipelines.geopoint.md
- title: Ordering
path: /docs/reference/js/firestore_pipelines.ordering.md
- title: Pipeline
path: /docs/reference/js/firestore_pipelines.pipeline.md
- title: PipelineExecuteOptions
path: /docs/reference/js/firestore_pipelines.pipelineexecuteoptions.md
- title: PipelineResult
path: /docs/reference/js/firestore_pipelines.pipelineresult.md
- title: PipelineSnapshot
path: /docs/reference/js/firestore_pipelines.pipelinesnapshot.md
- title: PipelineSource
path: /docs/reference/js/firestore_pipelines.pipelinesource.md
- title: Query
path: /docs/reference/js/firestore_pipelines.query.md
- title: QueryDocumentSnapshot
path: /docs/reference/js/firestore_pipelines.querydocumentsnapshot.md
- title: Selectable
path: /docs/reference/js/firestore_pipelines.selectable.md
- title: SnapshotMetadata
path: /docs/reference/js/firestore_pipelines.snapshotmetadata.md
- title: SnapshotOptions
path: /docs/reference/js/firestore_pipelines.snapshotoptions.md
- title: StageOptions
path: /docs/reference/js/firestore_pipelines.stageoptions.md
- title: Timestamp
path: /docs/reference/js/firestore_pipelines.timestamp.md
- title: VectorValue
path: /docs/reference/js/firestore_pipelines.vectorvalue.md
- title: functions
path: /docs/reference/js/functions.md
section:
+2
View File
@@ -16,4 +16,6 @@ Cloud Firestore
| --- | --- |
| [/](./firestore_.md#@firebase/firestore) | |
| [/lite](./firestore_lite.md#@firebase/firestore/lite) | |
| [/lite/pipelines](./firestore_lite_pipelines.md#@firebase/firestore/lite/pipelines) | |
| [/pipelines](./firestore_pipelines.md#@firebase/firestore/pipelines) | |
@@ -0,0 +1,109 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# AggregateFunction class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
A class that represents an aggregate function.
<b>Signature:</b>
```typescript
export declare class AggregateFunction
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(name, params)](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunctionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>AggregateFunction</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [exprType](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunctionexprtype) | | [ExpressionType](./firestore_lite_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [as(name)](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunctionas) | | <b><i>(Public Preview)</i></b> Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document.
```typescript
// Calculate the average price of all items and assign it the alias "averagePrice".
firestore.pipeline().collection("items")
.aggregate(field("price").average().as("averagePrice"));
```
|
## AggregateFunction.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `AggregateFunction` class
<b>Signature:</b>
```typescript
constructor(name: string, params: Expression[]);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | |
| params | [Expression](./firestore_lite_pipelines.expression.md#expression_class)<!-- -->\[\] | |
## AggregateFunction.exprType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
exprType: ExpressionType;
```
## AggregateFunction.as()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document.
```typescript
// Calculate the average price of all items and assign it the alias "averagePrice".
firestore.pipeline().collection("items")
.aggregate(field("price").average().as("averagePrice"));
```
<b>Signature:</b>
```typescript
as(name: string): AliasedAggregate;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | The alias to assign to this AggregateFunction. A new that wraps this AggregateFunction and associates it with the provided alias. |
<b>Returns:</b>
[AliasedAggregate](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregate_class)
@@ -0,0 +1,78 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# AliasedAggregate class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An AggregateFunction with alias.
<b>Signature:</b>
```typescript
export declare class AliasedAggregate
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(aggregate, alias, \_methodName)](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregateconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>AliasedAggregate</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [aggregate](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregateaggregate) | | [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) | <b><i>(Public Preview)</i></b> |
| [alias](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregatealias) | | string | <b><i>(Public Preview)</i></b> |
## AliasedAggregate.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `AliasedAggregate` class
<b>Signature:</b>
```typescript
constructor(aggregate: AggregateFunction, alias: string, _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| aggregate | [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) | |
| alias | string | |
| \_methodName | string \| undefined | |
## AliasedAggregate.aggregate
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly aggregate: AggregateFunction;
```
## AliasedAggregate.alias
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly alias: string;
```
@@ -0,0 +1,102 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# AliasedExpression class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
export declare class AliasedExpression implements Selectable
```
<b>Implements:</b> [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(expr, alias, \_methodName)](./firestore_lite_pipelines.aliasedexpression.md#aliasedexpressionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>AliasedExpression</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [alias](./firestore_lite_pipelines.aliasedexpression.md#aliasedexpressionalias) | | string | <b><i>(Public Preview)</i></b> |
| [expr](./firestore_lite_pipelines.aliasedexpression.md#aliasedexpressionexpr) | | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | <b><i>(Public Preview)</i></b> |
| [exprType](./firestore_lite_pipelines.aliasedexpression.md#aliasedexpressionexprtype) | | [ExpressionType](./firestore_lite_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
| [selectable](./firestore_lite_pipelines.aliasedexpression.md#aliasedexpressionselectable) | | true | <b><i>(Public Preview)</i></b> |
## AliasedExpression.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `AliasedExpression` class
<b>Signature:</b>
```typescript
constructor(expr: Expression, alias: string, _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | |
| alias | string | |
| \_methodName | string \| undefined | |
## AliasedExpression.alias
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly alias: string;
```
## AliasedExpression.expr
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expr: Expression;
```
## AliasedExpression.exprType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
exprType: ExpressionType;
```
## AliasedExpression.selectable
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
selectable: true;
```
@@ -0,0 +1,274 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# BooleanExpression class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An interface that represents a filter condition.
<b>Signature:</b>
```typescript
export declare abstract class BooleanExpression extends Expression
```
<b>Extends:</b> [Expression](./firestore_lite_pipelines.expression.md#expression_class)
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [conditional(thenExpr, elseExpr)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressionconditional) | | <b><i>(Public Preview)</i></b> Creates a conditional expression that evaluates to the 'then' expression if <code>this</code> expression evaluates to <code>true</code>, or evaluates to the 'else' expression if <code>this</code> expressions evaluates <code>false</code>.
```typescript
// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor".
field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor"));
```
|
| [countIf()](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioncountif) | | <b><i>(Public Preview)</i></b> Creates an aggregation that finds the count of input documents satisfying this boolean expression.
```typescript
// Find the count of documents with a score greater than 90
field("score").greaterThan(90).countIf().as("highestScore");
```
A new <code>AggregateFunction</code> representing the 'countIf' aggregation. |
| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(constant(false));
```
|
| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(false);
```
|
| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(constant(0));
```
|
| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(0);
```
|
| [not()](./firestore_lite_pipelines.booleanexpression.md#booleanexpressionnot) | | <b><i>(Public Preview)</i></b> Creates an expression that negates this boolean expression.
```typescript
// Find documents where the 'tags' field does not contain 'completed'
field("tags").arrayContains("completed").not();
```
A new representing the negated filter condition. |
## BooleanExpression.conditional()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates a conditional expression that evaluates to the 'then' expression if `this` expression evaluates to `true`<!-- -->, or evaluates to the 'else' expression if `this` expressions evaluates `false`<!-- -->.
```typescript
// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor".
field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor"));
```
<b>Signature:</b>
```typescript
conditional(thenExpr: Expression, elseExpr: Expression): FunctionExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| thenExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is true. |
| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. A new representing the conditional expression. |
<b>Returns:</b>
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
## BooleanExpression.countIf()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an aggregation that finds the count of input documents satisfying this boolean expression.
```typescript
// Find the count of documents with a score greater than 90
field("score").greaterThan(90).countIf().as("highestScore");
```
A new `AggregateFunction` representing the 'countIf' aggregation.
<b>Signature:</b>
```typescript
countIf(): AggregateFunction;
```
<b>Returns:</b>
[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(constant(false));
```
<b>Signature:</b>
```typescript
ifError(catchValue: BooleanExpression): BooleanExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(false);
```
<b>Signature:</b>
```typescript
ifError(catchValue: boolean): BooleanExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | boolean | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(constant(0));
```
<b>Signature:</b>
```typescript
ifError(catchValue: Expression): FunctionExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(0);
```
<b>Signature:</b>
```typescript
ifError(catchValue: unknown): FunctionExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | unknown | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
## BooleanExpression.not()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that negates this boolean expression.
```typescript
// Find documents where the 'tags' field does not contain 'completed'
field("tags").arrayContains("completed").not();
```
A new representing the negated filter condition.
<b>Signature:</b>
```typescript
not(): BooleanExpression;
```
<b>Returns:</b>
[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)
@@ -0,0 +1,177 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Bytes class
An immutable object representing an array of bytes.
<b>Signature:</b>
```typescript
export declare class Bytes
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromBase64String(base64)](./firestore_lite_pipelines.bytes.md#bytesfrombase64string) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Base64 string, converting it to bytes. |
| [fromJSON(json)](./firestore_lite_pipelines.bytes.md#bytesfromjson) | <code>static</code> | Builds a <code>Bytes</code> instance from a JSON object created by [Bytes.toJSON()](./firestore_.bytes.md#bytestojson)<!-- -->. |
| [fromUint8Array(array)](./firestore_lite_pipelines.bytes.md#bytesfromuint8array) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Uint8Array. |
| [isEqual(other)](./firestore_lite_pipelines.bytes.md#bytesisequal) | | Returns true if this <code>Bytes</code> object is equal to the provided one. |
| [toBase64()](./firestore_lite_pipelines.bytes.md#bytestobase64) | | Returns the underlying bytes as a Base64-encoded string. |
| [toJSON()](./firestore_lite_pipelines.bytes.md#bytestojson) | | Returns a JSON-serializable representation of this <code>Bytes</code> instance. |
| [toString()](./firestore_lite_pipelines.bytes.md#bytestostring) | | Returns a string representation of the <code>Bytes</code> object. |
| [toUint8Array()](./firestore_lite_pipelines.bytes.md#bytestouint8array) | | Returns the underlying bytes in a new <code>Uint8Array</code>. |
## Bytes.fromBase64String()
Creates a new `Bytes` object from the given Base64 string, converting it to bytes.
<b>Signature:</b>
```typescript
static fromBase64String(base64: string): Bytes;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| base64 | string | The Base64 string used to create the <code>Bytes</code> object. |
<b>Returns:</b>
[Bytes](./firestore_lite.bytes.md#bytes_class)
## Bytes.fromJSON()
Builds a `Bytes` instance from a JSON object created by [Bytes.toJSON()](./firestore_.bytes.md#bytestojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): Bytes;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | a JSON object represention of a <code>Bytes</code> instance |
<b>Returns:</b>
[Bytes](./firestore_lite.bytes.md#bytes_class)
an instance of [Bytes](./firestore_.bytes.md#bytes_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## Bytes.fromUint8Array()
Creates a new `Bytes` object from the given Uint8Array.
<b>Signature:</b>
```typescript
static fromUint8Array(array: Uint8Array): Bytes;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| array | Uint8Array | The Uint8Array used to create the <code>Bytes</code> object. |
<b>Returns:</b>
[Bytes](./firestore_lite.bytes.md#bytes_class)
## Bytes.isEqual()
Returns true if this `Bytes` object is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: Bytes): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [Bytes](./firestore_lite.bytes.md#bytes_class) | The <code>Bytes</code> object to compare against. |
<b>Returns:</b>
boolean
true if this `Bytes` object is equal to the provided one.
## Bytes.toBase64()
Returns the underlying bytes as a Base64-encoded string.
<b>Signature:</b>
```typescript
toBase64(): string;
```
<b>Returns:</b>
string
The Base64-encoded string created from the `Bytes` object.
## Bytes.toJSON()
Returns a JSON-serializable representation of this `Bytes` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
a JSON representation of this object.
## Bytes.toString()
Returns a string representation of the `Bytes` object.
<b>Signature:</b>
```typescript
toString(): string;
```
<b>Returns:</b>
string
A string representation of the `Bytes` object.
## Bytes.toUint8Array()
Returns the underlying bytes in a new `Uint8Array`<!-- -->.
<b>Signature:</b>
```typescript
toUint8Array(): Uint8Array;
```
<b>Returns:</b>
Uint8Array
The Uint8Array created from the `Bytes` object.
@@ -0,0 +1,121 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# CollectionReference class
A `CollectionReference` object can be used for adding documents, getting document references, and querying for documents (using [query()](./firestore_.md#query_9f7b0f4)<!-- -->).
<b>Signature:</b>
```typescript
export declare class CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends Query<AppModelType, DbModelType>
```
<b>Extends:</b> [Query](./firestore_lite.query.md#query_class)<!-- -->&lt;AppModelType, DbModelType&gt;
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [id](./firestore_lite_pipelines.collectionreference.md#collectionreferenceid) | | string | The collection's identifier. |
| [parent](./firestore_lite_pipelines.collectionreference.md#collectionreferenceparent) | | [DocumentReference](./firestore_lite.documentreference.md#documentreference_class)<!-- -->&lt;[DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->&gt; \| null | A reference to the containing <code>DocumentReference</code> if this is a subcollection. If this isn't a subcollection, the reference is null. |
| [path](./firestore_lite_pipelines.collectionreference.md#collectionreferencepath) | | string | A string representing the path of the referenced collection (relative to the root of the database). |
| [type](./firestore_lite_pipelines.collectionreference.md#collectionreferencetype) | | (not declared) | The type of this Firestore reference. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [withConverter(converter)](./firestore_lite_pipelines.collectionreference.md#collectionreferencewithconverter) | | Applies a custom data converter to this <code>CollectionReference</code>, allowing you to use your own custom model objects with Firestore. When you call [addDoc()](./firestore_.md#adddoc_6e783ff) with the returned <code>CollectionReference</code> instance, the provided converter will convert between Firestore data of type <code>NewDbModelType</code> and your custom type <code>NewAppModelType</code>. |
| [withConverter(converter)](./firestore_lite_pipelines.collectionreference.md#collectionreferencewithconverter) | | Removes the current converter. |
## CollectionReference.id
The collection's identifier.
<b>Signature:</b>
```typescript
get id(): string;
```
## CollectionReference.parent
A reference to the containing `DocumentReference` if this is a subcollection. If this isn't a subcollection, the reference is null.
<b>Signature:</b>
```typescript
get parent(): DocumentReference<DocumentData, DocumentData> | null;
```
## CollectionReference.path
A string representing the path of the referenced collection (relative to the root of the database).
<b>Signature:</b>
```typescript
get path(): string;
```
## CollectionReference.type
The type of this Firestore reference.
<b>Signature:</b>
```typescript
readonly type = "collection";
```
## CollectionReference.withConverter()
Applies a custom data converter to this `CollectionReference`<!-- -->, allowing you to use your own custom model objects with Firestore. When you call [addDoc()](./firestore_.md#adddoc_6e783ff) with the returned `CollectionReference` instance, the provided converter will convert between Firestore data of type `NewDbModelType` and your custom type `NewAppModelType`<!-- -->.
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[CollectionReference](./firestore_lite.collectionreference.md#collectionreference_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
A `CollectionReference` that uses the provided converter.
## CollectionReference.withConverter()
Removes the current converter.
<b>Signature:</b>
```typescript
withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | null | <code>null</code> removes the current converter. |
<b>Returns:</b>
[CollectionReference](./firestore_lite.collectionreference.md#collectionreference_class)<!-- -->&lt;[DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->&gt;
A `CollectionReference<DocumentData, DocumentData>` that does not use a converter.
@@ -0,0 +1,19 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# DocumentData interface
Document data (for use with [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->) consists of fields mapped to values.
<b>Signature:</b>
```typescript
export declare interface DocumentData
```
@@ -0,0 +1,207 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# DocumentReference class
A `DocumentReference` refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist.
<b>Signature:</b>
```typescript
export declare class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>
```
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [converter](./firestore_lite_pipelines.documentreference.md#documentreferenceconverter) | | [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;AppModelType, DbModelType&gt; \| null | If provided, the <code>FirestoreDataConverter</code> associated with this instance. |
| [firestore](./firestore_lite_pipelines.documentreference.md#documentreferencefirestore) | | [Firestore](./firestore_lite.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the document is in. This is useful for performing transactions, for example. |
| [id](./firestore_lite_pipelines.documentreference.md#documentreferenceid) | | string | The document's identifier within its collection. |
| [parent](./firestore_lite_pipelines.documentreference.md#documentreferenceparent) | | [CollectionReference](./firestore_lite.collectionreference.md#collectionreference_class)<!-- -->&lt;AppModelType, DbModelType&gt; | The collection this <code>DocumentReference</code> belongs to. |
| [path](./firestore_lite_pipelines.documentreference.md#documentreferencepath) | | string | A string representing the path of the referenced document (relative to the root of the database). |
| [type](./firestore_lite_pipelines.documentreference.md#documentreferencetype) | | (not declared) | The type of this Firestore reference. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(firestore, json)](./firestore_lite_pipelines.documentreference.md#documentreferencefromjson) | <code>static</code> | Builds a <code>DocumentReference</code> instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->. |
| [fromJSON(firestore, json, converter)](./firestore_lite_pipelines.documentreference.md#documentreferencefromjson) | <code>static</code> | Builds a <code>DocumentReference</code> instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->. |
| [toJSON()](./firestore_lite_pipelines.documentreference.md#documentreferencetojson) | | Returns a JSON-serializable representation of this <code>DocumentReference</code> instance. |
| [withConverter(converter)](./firestore_lite_pipelines.documentreference.md#documentreferencewithconverter) | | Applies a custom data converter to this <code>DocumentReference</code>, allowing you to use your own custom model objects with Firestore. When you call [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, [getDoc()](./firestore_lite.md#getdoc_4569087)<!-- -->, etc. with the returned <code>DocumentReference</code> instance, the provided converter will convert between Firestore data of type <code>NewDbModelType</code> and your custom type <code>NewAppModelType</code>. |
| [withConverter(converter)](./firestore_lite_pipelines.documentreference.md#documentreferencewithconverter) | | Removes the current converter. |
## DocumentReference.converter
If provided, the `FirestoreDataConverter` associated with this instance.
<b>Signature:</b>
```typescript
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
```
## DocumentReference.firestore
The [Firestore](./firestore_.firestore.md#firestore_class) instance the document is in. This is useful for performing transactions, for example.
<b>Signature:</b>
```typescript
readonly firestore: Firestore;
```
## DocumentReference.id
The document's identifier within its collection.
<b>Signature:</b>
```typescript
get id(): string;
```
## DocumentReference.parent
The collection this `DocumentReference` belongs to.
<b>Signature:</b>
```typescript
get parent(): CollectionReference<AppModelType, DbModelType>;
```
## DocumentReference.path
A string representing the path of the referenced document (relative to the root of the database).
<b>Signature:</b>
```typescript
get path(): string;
```
## DocumentReference.type
The type of this Firestore reference.
<b>Signature:</b>
```typescript
readonly type = "document";
```
## DocumentReference.fromJSON()
Builds a `DocumentReference` instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(firestore: Firestore, json: object): DocumentReference;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| firestore | [Firestore](./firestore_lite.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the snapshot should be loaded for. |
| json | object | a JSON object represention of a <code>DocumentReference</code> instance |
<b>Returns:</b>
[DocumentReference](./firestore_lite.documentreference.md#documentreference_class)
an instance of [DocumentReference](./firestore_.documentreference.md#documentreference_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## DocumentReference.fromJSON()
Builds a `DocumentReference` instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| firestore | [Firestore](./firestore_lite.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the snapshot should be loaded for. |
| json | object | a JSON object represention of a <code>DocumentReference</code> instance |
| converter | [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[DocumentReference](./firestore_lite.documentreference.md#documentreference_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
an instance of [DocumentReference](./firestore_.documentreference.md#documentreference_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## DocumentReference.toJSON()
Returns a JSON-serializable representation of this `DocumentReference` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
a JSON representation of this object.
## DocumentReference.withConverter()
Applies a custom data converter to this `DocumentReference`<!-- -->, allowing you to use your own custom model objects with Firestore. When you call [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, [getDoc()](./firestore_lite.md#getdoc_4569087)<!-- -->, etc. with the returned `DocumentReference` instance, the provided converter will convert between Firestore data of type `NewDbModelType` and your custom type `NewAppModelType`<!-- -->.
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[DocumentReference](./firestore_lite.documentreference.md#documentreference_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
A `DocumentReference` that uses the provided converter.
## DocumentReference.withConverter()
Removes the current converter.
<b>Signature:</b>
```typescript
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | null | <code>null</code> removes the current converter. |
<b>Returns:</b>
[DocumentReference](./firestore_lite.documentreference.md#documentreference_class)<!-- -->&lt;[DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->&gt;
A `DocumentReference<DocumentData, DocumentData>` that does not use a converter.
@@ -0,0 +1,125 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# DocumentSnapshot class
A `DocumentSnapshot` contains data read from a document in your Firestore database. The data can be extracted with `.data()` or `.get(<field>)` to get a specific field.
For a `DocumentSnapshot` that points to a non-existing document, any data access will return 'undefined'. You can use the `exists()` method to explicitly verify a document's existence.
<b>Signature:</b>
```typescript
export declare class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)()](./firestore_lite_pipelines.documentsnapshot.md#documentsnapshotconstructor) | | Constructs a new instance of the <code>DocumentSnapshot</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [id](./firestore_lite_pipelines.documentsnapshot.md#documentsnapshotid) | | string | Property of the <code>DocumentSnapshot</code> that provides the document's ID. |
| [ref](./firestore_lite_pipelines.documentsnapshot.md#documentsnapshotref) | | [DocumentReference](./firestore_lite.documentreference.md#documentreference_class)<!-- -->&lt;AppModelType, DbModelType&gt; | The <code>DocumentReference</code> for the document included in the <code>DocumentSnapshot</code>. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [data()](./firestore_lite_pipelines.documentsnapshot.md#documentsnapshotdata) | | Retrieves all fields in the document as an <code>Object</code>. Returns <code>undefined</code> if the document doesn't exist. |
| [exists()](./firestore_lite_pipelines.documentsnapshot.md#documentsnapshotexists) | | Signals whether or not the document at the snapshot's location exists. |
| [get(fieldPath)](./firestore_lite_pipelines.documentsnapshot.md#documentsnapshotget) | | Retrieves the field specified by <code>fieldPath</code>. Returns <code>undefined</code> if the document or field doesn't exist. |
## DocumentSnapshot.(constructor)
Constructs a new instance of the `DocumentSnapshot` class
<b>Signature:</b>
```typescript
protected constructor();
```
## DocumentSnapshot.id
Property of the `DocumentSnapshot` that provides the document's ID.
<b>Signature:</b>
```typescript
get id(): string;
```
## DocumentSnapshot.ref
The `DocumentReference` for the document included in the `DocumentSnapshot`<!-- -->.
<b>Signature:</b>
```typescript
get ref(): DocumentReference<AppModelType, DbModelType>;
```
## DocumentSnapshot.data()
Retrieves all fields in the document as an `Object`<!-- -->. Returns `undefined` if the document doesn't exist.
<b>Signature:</b>
```typescript
data(): AppModelType | undefined;
```
<b>Returns:</b>
AppModelType \| undefined
An `Object` containing all fields in the document or `undefined` if the document doesn't exist.
## DocumentSnapshot.exists()
Signals whether or not the document at the snapshot's location exists.
<b>Signature:</b>
```typescript
exists(): this is QueryDocumentSnapshot<AppModelType, DbModelType>;
```
<b>Returns:</b>
this is [QueryDocumentSnapshot](./firestore_lite.querydocumentsnapshot.md#querydocumentsnapshot_class)<!-- -->&lt;AppModelType, DbModelType&gt;
true if the document exists.
## DocumentSnapshot.get()
Retrieves the field specified by `fieldPath`<!-- -->. Returns `undefined` if the document or field doesn't exist.
<b>Signature:</b>
```typescript
get(fieldPath: string | FieldPath): any;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldPath | string \| [FieldPath](./firestore_lite.fieldpath.md#fieldpath_class) | The path (for example 'foo' or 'foo.bar') to a specific field. |
<b>Returns:</b>
any
The data at the specified field location or undefined if no such field exists in the document.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,103 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Field class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Represents a reference to a field in a Firestore document, or outputs of a stage.
<p>Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.
<p>You can create a `Field` instance using the static method:
```typescript
// Create a Field instance for the 'name' field
const nameField = field("name");
// Create a Field instance for a nested field 'address.city'
const cityField = field("address.city");
```
<b>Signature:</b>
```typescript
export declare class Field extends Expression implements Selectable
```
<b>Extends:</b> [Expression](./firestore_lite_pipelines.expression.md#expression_class)
<b>Implements:</b> [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface)
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [alias](./firestore_lite_pipelines.field.md#fieldalias) | | string | <b><i>(Public Preview)</i></b> |
| [expr](./firestore_lite_pipelines.field.md#fieldexpr) | | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | <b><i>(Public Preview)</i></b> |
| [expressionType](./firestore_lite_pipelines.field.md#fieldexpressiontype) | | [ExpressionType](./firestore_lite_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
| [fieldName](./firestore_lite_pipelines.field.md#fieldfieldname) | | string | <b><i>(Public Preview)</i></b> |
| [selectable](./firestore_lite_pipelines.field.md#fieldselectable) | | true | <b><i>(Public Preview)</i></b> |
## Field.alias
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
get alias(): string;
```
## Field.expr
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
get expr(): Expression;
```
## Field.expressionType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expressionType: ExpressionType;
```
## Field.fieldName
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
get fieldName(): string;
```
## Field.selectable
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
selectable: true;
```
@@ -0,0 +1,72 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FieldPath class
A `FieldPath` refers to a field in a document. The path may consist of a single field name (referring to a top-level field in the document), or a list of field names (referring to a nested field in the document).
Create a `FieldPath` by providing field names. If more than one field name is provided, the path will point to a nested field in a document.
<b>Signature:</b>
```typescript
export declare class FieldPath
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(fieldNames)](./firestore_lite_pipelines.fieldpath.md#fieldpathconstructor) | | Creates a <code>FieldPath</code> from the provided field names. If more than one field name is provided, the path will point to a nested field in a document. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [isEqual(other)](./firestore_lite_pipelines.fieldpath.md#fieldpathisequal) | | Returns true if this <code>FieldPath</code> is equal to the provided one. |
## FieldPath.(constructor)
Creates a `FieldPath` from the provided field names. If more than one field name is provided, the path will point to a nested field in a document.
<b>Signature:</b>
```typescript
constructor(...fieldNames: string[]);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldNames | string\[\] | A list of field names. |
## FieldPath.isEqual()
Returns true if this `FieldPath` is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: FieldPath): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [FieldPath](./firestore_lite.fieldpath.md#fieldpath_class) | The <code>FieldPath</code> to compare against. |
<b>Returns:</b>
boolean
true if this `FieldPath` is equal to the provided one.
@@ -0,0 +1,46 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FieldValue class
Sentinel values that can be used when writing document fields with `set()` or `update()`<!-- -->.
<b>Signature:</b>
```typescript
export declare abstract class FieldValue
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [isEqual(other)](./firestore_lite_pipelines.fieldvalue.md#fieldvalueisequal) | | Compares <code>FieldValue</code>s for equality. |
## FieldValue.isEqual()
Compares `FieldValue`<!-- -->s for equality.
<b>Signature:</b>
```typescript
abstract isEqual(other: FieldValue): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [FieldValue](./firestore_lite.fieldvalue.md#fieldvalue_class) | |
<b>Returns:</b>
boolean
@@ -0,0 +1,68 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Firestore class
The Cloud Firestore service interface.
Do not call this constructor directly. Instead, use [getFirestore()](./firestore_.md#getfirestore)<!-- -->.
<b>Signature:</b>
```typescript
export declare class Firestore
```
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [app](./firestore_lite_pipelines.firestore.md#firestoreapp) | | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) associated with this <code>Firestore</code> service instance. |
| [type](./firestore_lite_pipelines.firestore.md#firestoretype) | | 'firestore-lite' \| 'firestore' | Whether it's a Firestore or Firestore Lite instance. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [toJSON()](./firestore_lite_pipelines.firestore.md#firestoretojson) | | Returns a JSON-serializable representation of this <code>Firestore</code> instance. |
## Firestore.app
The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) associated with this `Firestore` service instance.
<b>Signature:</b>
```typescript
get app(): FirebaseApp;
```
## Firestore.type
Whether it's a Firestore or Firestore Lite instance.
<b>Signature:</b>
```typescript
type: 'firestore-lite' | 'firestore';
```
## Firestore.toJSON()
Returns a JSON-serializable representation of this `Firestore` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
@@ -0,0 +1,261 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FirestoreDataConverter interface
Converter used by `withConverter()` to transform user objects of type `AppModelType` into Firestore data of type `DbModelType`<!-- -->.
Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore.
In this context, an "AppModel" is a class that is used in an application to package together related information and functionality. Such a class could, for example, have properties with complex, nested data types, properties used for memoization, properties of types not supported by Firestore (such as `symbol` and `bigint`<!-- -->), and helper functions that perform compound operations. Such classes are not suitable and/or possible to store into a Firestore database. Instead, instances of such classes need to be converted to "plain old JavaScript objects" (POJOs) with exclusively primitive properties, potentially nested inside other POJOs or arrays of POJOs. In this context, this type is referred to as the "DbModel" and would be an object suitable for persisting into Firestore. For convenience, applications can implement `FirestoreDataConverter` and register the converter with Firestore objects, such as `DocumentReference` or `Query`<!-- -->, to automatically convert `AppModel` to `DbModel` when storing into Firestore, and convert `DbModel` to `AppModel` when retrieving from Firestore.
<b>Signature:</b>
```typescript
export declare interface FirestoreDataConverter<AppModelType, DbModelType extends DocumentData = DocumentData>
```
## Methods
| Method | Description |
| --- | --- |
| [fromFirestore(snapshot)](./firestore_lite_pipelines.firestoredataconverter.md#firestoredataconverterfromfirestore) | Called by the Firestore SDK to convert Firestore data into an object of type <code>AppModelType</code>. You can access your data by calling: <code>snapshot.data()</code>.<!-- -->Generally, the data returned from <code>snapshot.data()</code> can be cast to <code>DbModelType</code>; however, this is not guaranteed because Firestore does not enforce a schema on the database. For example, writes from a previous version of the application or writes from another client that did not use a type converter could have written data with different properties and/or property types. The implementation will need to choose whether to gracefully recover from non-conforming data or throw an error. |
| [toFirestore(modelObject)](./firestore_lite_pipelines.firestoredataconverter.md#firestoredataconvertertofirestore) | Called by the Firestore SDK to convert a custom model object of type <code>AppModelType</code> into a plain JavaScript object (suitable for writing directly to the Firestore database) of type <code>DbModelType</code>. Used with [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, and .<!-- -->The <code>WithFieldValue&lt;T&gt;</code> type extends <code>T</code> to also allow FieldValues such as [deleteField()](./firestore_.md#deletefield) to be used as property values. |
| [toFirestore(modelObject, options)](./firestore_lite_pipelines.firestoredataconverter.md#firestoredataconvertertofirestore) | Called by the Firestore SDK to convert a custom model object of type <code>AppModelType</code> into a plain JavaScript object (suitable for writing directly to the Firestore database) of type <code>DbModelType</code>. Used with [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, and with <code>merge:true</code> or <code>mergeFields</code>.<!-- -->The <code>PartialWithFieldValue&lt;T&gt;</code> type extends <code>Partial&lt;T&gt;</code> to allow FieldValues such as [arrayUnion()](./firestore_.md#arrayunion_7d853aa) to be used as property values. It also supports nested <code>Partial</code> by allowing nested fields to be omitted. |
## FirestoreDataConverter.fromFirestore()
Called by the Firestore SDK to convert Firestore data into an object of type `AppModelType`<!-- -->. You can access your data by calling: `snapshot.data()`<!-- -->.
Generally, the data returned from `snapshot.data()` can be cast to `DbModelType`<!-- -->; however, this is not guaranteed because Firestore does not enforce a schema on the database. For example, writes from a previous version of the application or writes from another client that did not use a type converter could have written data with different properties and/or property types. The implementation will need to choose whether to gracefully recover from non-conforming data or throw an error.
<b>Signature:</b>
```typescript
fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData, DocumentData>): AppModelType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| snapshot | [QueryDocumentSnapshot](./firestore_lite.querydocumentsnapshot.md#querydocumentsnapshot_class)<!-- -->&lt;[DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->&gt; | A <code>QueryDocumentSnapshot</code> containing your data and metadata. |
<b>Returns:</b>
AppModelType
## FirestoreDataConverter.toFirestore()
Called by the Firestore SDK to convert a custom model object of type `AppModelType` into a plain JavaScript object (suitable for writing directly to the Firestore database) of type `DbModelType`<!-- -->. Used with [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, and .
The `WithFieldValue<T>` type extends `T` to also allow FieldValues such as [deleteField()](./firestore_.md#deletefield) to be used as property values.
<b>Signature:</b>
```typescript
toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| modelObject | [WithFieldValue](./firestore_lite.md#withfieldvalue)<!-- -->&lt;AppModelType&gt; | |
<b>Returns:</b>
[WithFieldValue](./firestore_lite.md#withfieldvalue)<!-- -->&lt;DbModelType&gt;
## FirestoreDataConverter.toFirestore()
Called by the Firestore SDK to convert a custom model object of type `AppModelType` into a plain JavaScript object (suitable for writing directly to the Firestore database) of type `DbModelType`<!-- -->. Used with [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, and with `merge:true` or `mergeFields`<!-- -->.
The `PartialWithFieldValue<T>` type extends `Partial<T>` to allow FieldValues such as [arrayUnion()](./firestore_.md#arrayunion_7d853aa) to be used as property values. It also supports nested `Partial` by allowing nested fields to be omitted.
<b>Signature:</b>
```typescript
toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions): PartialWithFieldValue<DbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| modelObject | [PartialWithFieldValue](./firestore_lite.md#partialwithfieldvalue)<!-- -->&lt;AppModelType&gt; | |
| options | [SetOptions](./firestore_lite.md#setoptions) | |
<b>Returns:</b>
[PartialWithFieldValue](./firestore_lite.md#partialwithfieldvalue)<!-- -->&lt;DbModelType&gt;
### Example
Simple Example
```typescript
const numberConverter = {
toFirestore(value: WithFieldValue<number>) {
return { value };
},
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) {
return snapshot.data(options).value as number;
}
};
async function simpleDemo(db: Firestore): Promise<void> {
const documentRef = doc(db, 'values/value123').withConverter(numberConverter);
// converters are used with `setDoc`, `addDoc`, and `getDoc`
await setDoc(documentRef, 42);
const snapshot1 = await getDoc(documentRef);
assertEqual(snapshot1.data(), 42);
// converters are not used when writing data with `updateDoc`
await updateDoc(documentRef, { value: 999 });
const snapshot2 = await getDoc(documentRef);
assertEqual(snapshot2.data(), 999);
}
```
Advanced Example
```typescript
// The Post class is a model that is used by our application.
// This class may have properties and methods that are specific
// to our application execution, which do not need to be persisted
// to Firestore.
class Post {
constructor(
readonly title: string,
readonly author: string,
readonly lastUpdatedMillis: number
) {}
toString(): string {
return `${this.title} by ${this.author}`;
}
}
// The PostDbModel represents how we want our posts to be stored
// in Firestore. This DbModel has different properties (`ttl`,
// `aut`, and `lut`) from the Post class we use in our application.
interface PostDbModel {
ttl: string;
aut: { firstName: string; lastName: string };
lut: Timestamp;
}
// The `PostConverter` implements `FirestoreDataConverter` and specifies
// how the Firestore SDK can convert `Post` objects to `PostDbModel`
// objects and vice versa.
class PostConverter implements FirestoreDataConverter<Post, PostDbModel> {
toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> {
return {
ttl: post.title,
aut: this._autFromAuthor(post.author),
lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis)
};
}
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post {
const data = snapshot.data(options) as PostDbModel;
const author = `${data.aut.firstName} ${data.aut.lastName}`;
return new Post(data.ttl, author, data.lut.toMillis());
}
_autFromAuthor(
author: string | FieldValue
): { firstName: string; lastName: string } | FieldValue {
if (typeof author !== 'string') {
// `author` is a FieldValue, so just return it.
return author;
}
const [firstName, lastName] = author.split(' ');
return {firstName, lastName};
}
_lutFromLastUpdatedMillis(
lastUpdatedMillis: number | FieldValue
): Timestamp | FieldValue {
if (typeof lastUpdatedMillis !== 'number') {
// `lastUpdatedMillis` must be a FieldValue, so just return it.
return lastUpdatedMillis;
}
return Timestamp.fromMillis(lastUpdatedMillis);
}
}
async function advancedDemo(db: Firestore): Promise<void> {
// Create a `DocumentReference` with a `FirestoreDataConverter`.
const documentRef = doc(db, 'posts/post123').withConverter(new PostConverter());
// The `data` argument specified to `setDoc()` is type checked by the
// TypeScript compiler to be compatible with `Post`. Since the `data`
// argument is typed as `WithFieldValue<Post>` rather than just `Post`,
// this allows properties of the `data` argument to also be special
// Firestore values that perform server-side mutations, such as
// `arrayRemove()`, `deleteField()`, and `serverTimestamp()`.
await setDoc(documentRef, {
title: 'My Life',
author: 'Foo Bar',
lastUpdatedMillis: serverTimestamp()
});
// The TypeScript compiler will fail to compile if the `data` argument to
// `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This
// type checking prevents the caller from specifying objects with incorrect
// properties or property values.
// @ts-expect-error "Argument of type { ttl: string; } is not assignable
// to parameter of type WithFieldValue<Post>"
await setDoc(documentRef, { ttl: 'The Title' });
// When retrieving a document with `getDoc()` the `DocumentSnapshot`
// object's `data()` method returns a `Post`, rather than a generic object,
// which would have been returned if the `DocumentReference` did _not_ have a
// `FirestoreDataConverter` attached to it.
const snapshot1: DocumentSnapshot<Post> = await getDoc(documentRef);
const post1: Post = snapshot1.data()!;
if (post1) {
assertEqual(post1.title, 'My Life');
assertEqual(post1.author, 'Foo Bar');
}
// The `data` argument specified to `updateDoc()` is type checked by the
// TypeScript compiler to be compatible with `PostDbModel`. Note that
// unlike `setDoc()`, whose `data` argument must be compatible with `Post`,
// the `data` argument to `updateDoc()` must be compatible with
// `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed
// as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this
// allows properties of the `data` argument to also be those special
// Firestore values, like `arrayRemove()`, `deleteField()`, and
// `serverTimestamp()`.
await updateDoc(documentRef, {
'aut.firstName': 'NewFirstName',
lut: serverTimestamp()
});
// The TypeScript compiler will fail to compile if the `data` argument to
// `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`.
// This type checking prevents the caller from specifying objects with
// incorrect properties or property values.
// @ts-expect-error "Argument of type { title: string; } is not assignable
// to parameter of type WithFieldValue<PostDbModel>"
await updateDoc(documentRef, { title: 'New Title' });
const snapshot2: DocumentSnapshot<Post> = await getDoc(documentRef);
const post2: Post = snapshot2.data()!;
if (post2) {
assertEqual(post2.title, 'My Life');
assertEqual(post2.author, 'NewFirstName Bar');
}
}
```
@@ -0,0 +1,90 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FunctionExpression class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
This class defines the base class for Firestore functions, which can be evaluated within pipeline execution.
Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_.md#and_e72c712)<!-- -->, , or the methods on (<!-- -->, , etc.) to construct new Function instances.
<b>Signature:</b>
```typescript
export declare class FunctionExpression extends Expression
```
<b>Extends:</b> [Expression](./firestore_lite_pipelines.expression.md#expression_class)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(name, params)](./firestore_lite_pipelines.functionexpression.md#functionexpressionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>FunctionExpression</code> class |
| [(constructor)(name, params, \_methodName)](./firestore_lite_pipelines.functionexpression.md#functionexpressionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>FunctionExpression</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [expressionType](./firestore_lite_pipelines.functionexpression.md#functionexpressionexpressiontype) | | [ExpressionType](./firestore_lite_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
## FunctionExpression.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `FunctionExpression` class
<b>Signature:</b>
```typescript
constructor(name: string, params: Expression[]);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | |
| params | [Expression](./firestore_lite_pipelines.expression.md#expression_class)<!-- -->\[\] | |
## FunctionExpression.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `FunctionExpression` class
<b>Signature:</b>
```typescript
constructor(name: string, params: Expression[], _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | |
| params | [Expression](./firestore_lite_pipelines.expression.md#expression_class)<!-- -->\[\] | |
| \_methodName | string \| undefined | |
## FunctionExpression.expressionType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expressionType: ExpressionType;
```
@@ -0,0 +1,143 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# GeoPoint class
An immutable object representing a geographic location in Firestore. The location is represented as latitude/longitude pair.
Latitude values are in the range of \[-90, 90\]. Longitude values are in the range of \[-180, 180\].
<b>Signature:</b>
```typescript
export declare class GeoPoint
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(latitude, longitude)](./firestore_lite_pipelines.geopoint.md#geopointconstructor) | | Creates a new immutable <code>GeoPoint</code> object with the provided latitude and longitude values. |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [latitude](./firestore_lite_pipelines.geopoint.md#geopointlatitude) | | number | The latitude of this <code>GeoPoint</code> instance. |
| [longitude](./firestore_lite_pipelines.geopoint.md#geopointlongitude) | | number | The longitude of this <code>GeoPoint</code> instance. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(json)](./firestore_lite_pipelines.geopoint.md#geopointfromjson) | <code>static</code> | Builds a <code>GeoPoint</code> instance from a JSON object created by [GeoPoint.toJSON()](./firestore_.geopoint.md#geopointtojson)<!-- -->. |
| [isEqual(other)](./firestore_lite_pipelines.geopoint.md#geopointisequal) | | Returns true if this <code>GeoPoint</code> is equal to the provided one. |
| [toJSON()](./firestore_lite_pipelines.geopoint.md#geopointtojson) | | Returns a JSON-serializable representation of this <code>GeoPoint</code> instance. |
## GeoPoint.(constructor)
Creates a new immutable `GeoPoint` object with the provided latitude and longitude values.
<b>Signature:</b>
```typescript
constructor(latitude: number, longitude: number);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| latitude | number | The latitude as number between -90 and 90. |
| longitude | number | The longitude as number between -180 and 180. |
## GeoPoint.latitude
The latitude of this `GeoPoint` instance.
<b>Signature:</b>
```typescript
get latitude(): number;
```
## GeoPoint.longitude
The longitude of this `GeoPoint` instance.
<b>Signature:</b>
```typescript
get longitude(): number;
```
## GeoPoint.fromJSON()
Builds a `GeoPoint` instance from a JSON object created by [GeoPoint.toJSON()](./firestore_.geopoint.md#geopointtojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): GeoPoint;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | a JSON object represention of a <code>GeoPoint</code> instance |
<b>Returns:</b>
[GeoPoint](./firestore_lite.geopoint.md#geopoint_class)
an instance of [GeoPoint](./firestore_.geopoint.md#geopoint_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## GeoPoint.isEqual()
Returns true if this `GeoPoint` is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: GeoPoint): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [GeoPoint](./firestore_lite.geopoint.md#geopoint_class) | The <code>GeoPoint</code> to compare against. |
<b>Returns:</b>
boolean
true if this `GeoPoint` is equal to the provided one.
## GeoPoint.toJSON()
Returns a JSON-serializable representation of this `GeoPoint` instance.
<b>Signature:</b>
```typescript
toJSON(): {
latitude: number;
longitude: number;
type: string;
};
```
<b>Returns:</b>
{ latitude: number; longitude: number; type: string; }
a JSON representation of this object.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,80 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Ordering class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Represents an ordering criterion for sorting documents in a Firestore pipeline.
You create `Ordering` instances using the `ascending` and `descending` helper functions.
<b>Signature:</b>
```typescript
export declare class Ordering
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(expr, direction, \_methodName)](./firestore_lite_pipelines.ordering.md#orderingconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>Ordering</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [direction](./firestore_lite_pipelines.ordering.md#orderingdirection) | | 'ascending' \| 'descending' | <b><i>(Public Preview)</i></b> |
| [expr](./firestore_lite_pipelines.ordering.md#orderingexpr) | | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | <b><i>(Public Preview)</i></b> |
## Ordering.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `Ordering` class
<b>Signature:</b>
```typescript
constructor(expr: Expression, direction: 'ascending' | 'descending', _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | |
| direction | 'ascending' \| 'descending' | |
| \_methodName | string \| undefined | |
## Ordering.direction
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly direction: 'ascending' | 'descending';
```
## Ordering.expr
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expr: Expression;
```
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,168 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# PipelineResult class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the or methods.
<p>If the PipelineResult represents a non-document result, `ref` will return a undefined value.
<b>Signature:</b>
```typescript
export declare class PipelineResult<AppModelType = DocumentData>
```
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [createTime](./firestore_lite_pipelines.pipelineresult.md#pipelineresultcreatetime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) \| undefined | <b><i>(Public Preview)</i></b> The time the document was created. Undefined if this result is not a document. {<!-- -->Timestamp\|undefined<!-- -->} |
| [id](./firestore_lite_pipelines.pipelineresult.md#pipelineresultid) | | string \| undefined | <b><i>(Public Preview)</i></b> The ID of the document for which this PipelineResult contains data, if it is a document; otherwise <code>undefined</code>. {<!-- -->string<!-- -->} |
| [ref](./firestore_lite_pipelines.pipelineresult.md#pipelineresultref) | | [DocumentReference](./firestore_lite.documentreference.md#documentreference_class) \| undefined | <b><i>(Public Preview)</i></b> The reference of the document, if it is a document; otherwise <code>undefined</code>. |
| [updateTime](./firestore_lite_pipelines.pipelineresult.md#pipelineresultupdatetime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) \| undefined | <b><i>(Public Preview)</i></b> The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. {<!-- -->Timestamp\|undefined<!-- -->} |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [data()](./firestore_lite_pipelines.pipelineresult.md#pipelineresultdata) | | <b><i>(Public Preview)</i></b> Retrieves all fields in the result as an object. |
| [get(fieldPath)](./firestore_lite_pipelines.pipelineresult.md#pipelineresultget) | | <b><i>(Public Preview)</i></b> Retrieves the field specified by <code>field</code>. |
## PipelineResult.createTime
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The time the document was created. Undefined if this result is not a document.
{<!-- -->Timestamp\|undefined<!-- -->}
<b>Signature:</b>
```typescript
get createTime(): Timestamp | undefined;
```
## PipelineResult.id
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The ID of the document for which this PipelineResult contains data, if it is a document; otherwise `undefined`<!-- -->.
{<!-- -->string<!-- -->}
<b>Signature:</b>
```typescript
get id(): string | undefined;
```
## PipelineResult.ref
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The reference of the document, if it is a document; otherwise `undefined`<!-- -->.
<b>Signature:</b>
```typescript
get ref(): DocumentReference | undefined;
```
## PipelineResult.updateTime
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document.
{<!-- -->Timestamp\|undefined<!-- -->}
<b>Signature:</b>
```typescript
get updateTime(): Timestamp | undefined;
```
## PipelineResult.data()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Retrieves all fields in the result as an object.
<b>Signature:</b>
```typescript
data(): AppModelType;
```
<b>Returns:</b>
AppModelType
{<!-- -->T<!-- -->} An object containing all fields in the document or 'undefined' if the document doesn't exist.
### Example
```
let p = firestore.pipeline().collection('col');
p.execute().then(results => {
let data = results[0].data();
console.log(`Retrieved data: ${JSON.stringify(data)}`);
});
```
## PipelineResult.get()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Retrieves the field specified by `field`<!-- -->.
<b>Signature:</b>
```typescript
get(fieldPath: string | FieldPath | Field): any;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldPath | string \| [FieldPath](./firestore_lite.fieldpath.md#fieldpath_class) \| [Field](./firestore_lite_pipelines.field.md#field_class) | |
<b>Returns:</b>
any
{<!-- -->\*<!-- -->} The data at the specified field location or undefined if no such field exists.
### Example
```
let p = firestore.pipeline().collection('col');
p.execute().then(results => {
let field = results[0].get('a.b');
console.log(`Retrieved field value: ${field}`);
});
```
@@ -0,0 +1,103 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# PipelineSnapshot class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Represents the results of a Firestore pipeline execution.
A `PipelineSnapshot` contains zero or more objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results.
<b>Signature:</b>
```typescript
export declare class PipelineSnapshot
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(pipeline, results, executionTime)](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshotconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>PipelineSnapshot</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [executionTime](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshotexecutiontime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | <b><i>(Public Preview)</i></b> The time at which the pipeline producing this result is executed. {<!-- -->Timestamp<!-- -->} |
| [results](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshotresults) | | [PipelineResult](./firestore_lite_pipelines.pipelineresult.md#pipelineresult_class)<!-- -->\[\] | <b><i>(Public Preview)</i></b> An array of all the results in the <code>PipelineSnapshot</code>. |
## PipelineSnapshot.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `PipelineSnapshot` class
<b>Signature:</b>
```typescript
constructor(pipeline: Pipeline, results: PipelineResult[], executionTime?: Timestamp);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| pipeline | [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) | |
| results | [PipelineResult](./firestore_lite_pipelines.pipelineresult.md#pipelineresult_class)<!-- -->\[\] | |
| executionTime | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | |
## PipelineSnapshot.executionTime
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The time at which the pipeline producing this result is executed.
{<!-- -->Timestamp<!-- -->}
<b>Signature:</b>
```typescript
get executionTime(): Timestamp;
```
## PipelineSnapshot.results
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An array of all the results in the `PipelineSnapshot`<!-- -->.
<b>Signature:</b>
```typescript
get results(): PipelineResult[];
```
### Example
```typescript
const snapshot: PipelineSnapshot = await firestore
.pipeline()
.collection('myCollection')
.where(field('value').greaterThan(10))
.execute();
snapshot.results.forEach(doc => {
console.log(doc.id, '=>', doc.data());
});
```
@@ -0,0 +1,251 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# PipelineSource class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Provides the entry point for defining the data source of a Firestore .
Use the methods of this class (e.g., , , , or ) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents.
<b>Signature:</b>
```typescript
export declare class PipelineSource<PipelineType>
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [collection(collection)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcecollection) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire collection. The collection can be nested. |
| [collection(options)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcecollection) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire collection. The collection can be nested. |
| [collectionGroup(collectionId)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) | | <b><i>(Public Preview)</i></b> Returns all documents from a collection ID regardless of the parent. |
| [collectionGroup(options)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) | | <b><i>(Public Preview)</i></b> Returns all documents from a collection ID regardless of the parent. |
| [createFrom(query)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcecreatefrom) | | <b><i>(Public Preview)</i></b> Convert the given Query into an equivalent Pipeline. |
| [database()](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcedatabase) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire database. |
| [database(options)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcedatabase) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire database. |
| [documents(docs)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcedocuments) | | <b><i>(Public Preview)</i></b> Set the pipeline's source to the documents specified by the given paths and DocumentReferences. |
| [documents(options)](./firestore_lite_pipelines.pipelinesource.md#pipelinesourcedocuments) | | <b><i>(Public Preview)</i></b> Set the pipeline's source to the documents specified by the given paths and DocumentReferences. |
## PipelineSource.collection()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire collection. The collection can be nested.
<b>Signature:</b>
```typescript
collection(collection: string | Query): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| collection | string \| [Query](./firestore_lite.query.md#query_class) | Name or reference to the collection that will be used as the Pipeline source. |
<b>Returns:</b>
PipelineType
## PipelineSource.collection()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire collection. The collection can be nested.
<b>Signature:</b>
```typescript
collection(options: CollectionStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [CollectionStageOptions](./firestore_lite_pipelines.md#collectionstageoptions) | Options defining how this CollectionStage is evaluated. |
<b>Returns:</b>
PipelineType
## PipelineSource.collectionGroup()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from a collection ID regardless of the parent.
<b>Signature:</b>
```typescript
collectionGroup(collectionId: string): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| collectionId | string | ID of the collection group to use as the Pipeline source. |
<b>Returns:</b>
PipelineType
## PipelineSource.collectionGroup()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from a collection ID regardless of the parent.
<b>Signature:</b>
```typescript
collectionGroup(options: CollectionGroupStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [CollectionGroupStageOptions](./firestore_lite_pipelines.md#collectiongroupstageoptions) | Options defining how this CollectionGroupStage is evaluated. |
<b>Returns:</b>
PipelineType
## PipelineSource.createFrom()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Convert the given Query into an equivalent Pipeline.
<b>Signature:</b>
```typescript
createFrom(query: Query): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| query | [Query](./firestore_lite.query.md#query_class) | A Query to be converted into a Pipeline. |
<b>Returns:</b>
[Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class)
#### Exceptions
Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
## PipelineSource.database()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire database.
<b>Signature:</b>
```typescript
database(): PipelineType;
```
<b>Returns:</b>
PipelineType
## PipelineSource.database()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire database.
<b>Signature:</b>
```typescript
database(options: DatabaseStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [DatabaseStageOptions](./firestore_lite_pipelines.md#databasestageoptions) | Options defining how a DatabaseStage is evaluated. |
<b>Returns:</b>
PipelineType
## PipelineSource.documents()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Set the pipeline's source to the documents specified by the given paths and DocumentReferences.
<b>Signature:</b>
```typescript
documents(docs: Array<string | DocumentReference>): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| docs | Array&lt;string \| [DocumentReference](./firestore_lite.documentreference.md#documentreference_class)<!-- -->&gt; | An array of paths and DocumentReferences specifying the individual documents that will be the source of this pipeline. The converters for these DocumentReferences will be ignored and not have an effect on this pipeline. |
<b>Returns:</b>
PipelineType
#### Exceptions
Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
## PipelineSource.documents()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Set the pipeline's source to the documents specified by the given paths and DocumentReferences.
<b>Signature:</b>
```typescript
documents(options: DocumentsStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [DocumentsStageOptions](./firestore_lite_pipelines.md#documentsstageoptions) | Options defining how this DocumentsStage is evaluated. |
<b>Returns:</b>
PipelineType
#### Exceptions
Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
@@ -0,0 +1,125 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Query class
A `Query` refers to a query which you can read or listen to. You can also construct refined `Query` objects by adding filters and ordering.
<b>Signature:</b>
```typescript
export declare class Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)()](./firestore_lite_pipelines.query.md#queryconstructor) | | Constructs a new instance of the <code>Query</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [converter](./firestore_lite_pipelines.query.md#queryconverter) | | [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;AppModelType, DbModelType&gt; \| null | If provided, the <code>FirestoreDataConverter</code> associated with this instance. |
| [firestore](./firestore_lite_pipelines.query.md#queryfirestore) | | [Firestore](./firestore_lite.firestore.md#firestore_class) | The <code>Firestore</code> instance for the Firestore database (useful for performing transactions, etc.). |
| [type](./firestore_lite_pipelines.query.md#querytype) | | 'query' \| 'collection' | The type of this Firestore reference. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [withConverter(converter)](./firestore_lite_pipelines.query.md#querywithconverter) | | Removes the current converter. |
| [withConverter(converter)](./firestore_lite_pipelines.query.md#querywithconverter) | | Applies a custom data converter to this query, allowing you to use your own custom model objects with Firestore. When you call [getDocs()](./firestore_.md#getdocs_4e56953) with the returned query, the provided converter will convert between Firestore data of type <code>NewDbModelType</code> and your custom type <code>NewAppModelType</code>. |
## Query.(constructor)
Constructs a new instance of the `Query` class
<b>Signature:</b>
```typescript
protected constructor();
```
## Query.converter
If provided, the `FirestoreDataConverter` associated with this instance.
<b>Signature:</b>
```typescript
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
```
## Query.firestore
The `Firestore` instance for the Firestore database (useful for performing transactions, etc.).
<b>Signature:</b>
```typescript
readonly firestore: Firestore;
```
## Query.type
The type of this Firestore reference.
<b>Signature:</b>
```typescript
readonly type: 'query' | 'collection';
```
## Query.withConverter()
Removes the current converter.
<b>Signature:</b>
```typescript
withConverter(converter: null): Query<DocumentData, DocumentData>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | null | <code>null</code> removes the current converter. |
<b>Returns:</b>
[Query](./firestore_lite.query.md#query_class)<!-- -->&lt;[DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_lite.documentdata.md#documentdata_interface)<!-- -->&gt;
A `Query<DocumentData, DocumentData>` that does not use a converter.
## Query.withConverter()
Applies a custom data converter to this query, allowing you to use your own custom model objects with Firestore. When you call [getDocs()](./firestore_.md#getdocs_4e56953) with the returned query, the provided converter will convert between Firestore data of type `NewDbModelType` and your custom type `NewAppModelType`<!-- -->.
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[Query](./firestore_lite.query.md#query_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
A `Query` that uses the provided converter.
@@ -0,0 +1,45 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# QueryDocumentSnapshot class
A `QueryDocumentSnapshot` contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with `.data()` or `.get(<field>)` to get a specific field.
A `QueryDocumentSnapshot` offers the same API surface as a `DocumentSnapshot`<!-- -->. Since query results contain only existing documents, the `exists` property will always be true and `data()` will never return 'undefined'.
<b>Signature:</b>
```typescript
export declare class QueryDocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot<AppModelType, DbModelType>
```
<b>Extends:</b> [DocumentSnapshot](./firestore_lite.documentsnapshot.md#documentsnapshot_class)<!-- -->&lt;AppModelType, DbModelType&gt;
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [data()](./firestore_lite_pipelines.querydocumentsnapshot.md#querydocumentsnapshotdata) | | Retrieves all fields in the document as an <code>Object</code>. |
## QueryDocumentSnapshot.data()
Retrieves all fields in the document as an `Object`<!-- -->.
<b>Signature:</b>
```typescript
/** @override */
data(): AppModelType;
```
<b>Returns:</b>
AppModelType
An `Object` containing all fields in the document.
@@ -0,0 +1,39 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Selectable interface
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An interface that represents a selectable expression.
<b>Signature:</b>
```typescript
export declare interface Selectable
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [selectable](./firestore_lite_pipelines.selectable.md#selectableselectable) | true | <b><i>(Public Preview)</i></b> |
## Selectable.selectable
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
selectable: true;
```
@@ -0,0 +1,51 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# StageOptions interface
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Options defining how a Stage is evaluated.
<b>Signature:</b>
```typescript
export declare interface StageOptions
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [rawOptions](./firestore_lite_pipelines.stageoptions.md#stageoptionsrawoptions) | { \[name: string\]: unknown; } | <b><i>(Public Preview)</i></b> An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.<!-- -->The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).<!-- -->Raw option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.<!-- -->Values specified in rawOptions will take precedence over any options with the same name set by the SDK.<code>rawOptions</code> supports dot notation, if you want to override a nested option. |
## StageOptions.rawOptions
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.
The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).
Raw option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.
Values specified in rawOptions will take precedence over any options with the same name set by the SDK.
`rawOptions` supports dot notation, if you want to override a nested option.
<b>Signature:</b>
```typescript
rawOptions?: {
[name: string]: unknown;
};
```
@@ -0,0 +1,265 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Timestamp class
A `Timestamp` represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.
It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
For examples and further specifications, refer to the [Timestamp definition](https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto)<!-- -->.
<b>Signature:</b>
```typescript
export declare class Timestamp
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(seconds, nanoseconds)](./firestore_lite_pipelines.timestamp.md#timestampconstructor) | | Creates a new timestamp. |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [nanoseconds](./firestore_lite_pipelines.timestamp.md#timestampnanoseconds) | | number | The fractions of a second at nanosecond resolution.\* |
| [seconds](./firestore_lite_pipelines.timestamp.md#timestampseconds) | | number | The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromDate(date)](./firestore_lite_pipelines.timestamp.md#timestampfromdate) | <code>static</code> | Creates a new timestamp from the given date. |
| [fromJSON(json)](./firestore_lite_pipelines.timestamp.md#timestampfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->. |
| [fromMillis(milliseconds)](./firestore_lite_pipelines.timestamp.md#timestampfrommillis) | <code>static</code> | Creates a new timestamp from the given number of milliseconds. |
| [isEqual(other)](./firestore_lite_pipelines.timestamp.md#timestampisequal) | | Returns true if this <code>Timestamp</code> is equal to the provided one. |
| [now()](./firestore_lite_pipelines.timestamp.md#timestampnow) | <code>static</code> | Creates a new timestamp with the current date, with millisecond precision. |
| [toDate()](./firestore_lite_pipelines.timestamp.md#timestamptodate) | | Converts a <code>Timestamp</code> to a JavaScript <code>Date</code> object. This conversion causes a loss of precision since <code>Date</code> objects only support millisecond precision. |
| [toJSON()](./firestore_lite_pipelines.timestamp.md#timestamptojson) | | Returns a JSON-serializable representation of this <code>Timestamp</code>. |
| [toMillis()](./firestore_lite_pipelines.timestamp.md#timestamptomillis) | | Converts a <code>Timestamp</code> to a numeric timestamp (in milliseconds since epoch). This operation causes a loss of precision. |
| [toString()](./firestore_lite_pipelines.timestamp.md#timestamptostring) | | Returns a textual representation of this <code>Timestamp</code>. |
| [valueOf()](./firestore_lite_pipelines.timestamp.md#timestampvalueof) | | Converts this object to a primitive string, which allows <code>Timestamp</code> objects to be compared using the <code>&gt;</code>, <code>&lt;=</code>, <code>&gt;=</code> and <code>&gt;</code> operators. |
## Timestamp.(constructor)
Creates a new timestamp.
<b>Signature:</b>
```typescript
constructor(
seconds: number,
nanoseconds: number);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| seconds | number | The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. |
| nanoseconds | number | The non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanoseconds values that count forward in time. Must be from 0 to 999,999,999 inclusive. |
## Timestamp.nanoseconds
The fractions of a second at nanosecond resolution.\*
<b>Signature:</b>
```typescript
readonly nanoseconds: number;
```
## Timestamp.seconds
The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
<b>Signature:</b>
```typescript
readonly seconds: number;
```
## Timestamp.fromDate()
Creates a new timestamp from the given date.
<b>Signature:</b>
```typescript
static fromDate(date: Date): Timestamp;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| date | Date | The date to initialize the <code>Timestamp</code> from. |
<b>Returns:</b>
[Timestamp](./firestore_lite.timestamp.md#timestamp_class)
A new `Timestamp` representing the same point in time as the given date.
## Timestamp.fromJSON()
Builds a `Timestamp` instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): Timestamp;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | |
<b>Returns:</b>
[Timestamp](./firestore_lite.timestamp.md#timestamp_class)
## Timestamp.fromMillis()
Creates a new timestamp from the given number of milliseconds.
<b>Signature:</b>
```typescript
static fromMillis(milliseconds: number): Timestamp;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| milliseconds | number | Number of milliseconds since Unix epoch 1970-01-01T00:00:00Z. |
<b>Returns:</b>
[Timestamp](./firestore_lite.timestamp.md#timestamp_class)
A new `Timestamp` representing the same point in time as the given number of milliseconds.
## Timestamp.isEqual()
Returns true if this `Timestamp` is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: Timestamp): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | The <code>Timestamp</code> to compare against. |
<b>Returns:</b>
boolean
true if this `Timestamp` is equal to the provided one.
## Timestamp.now()
Creates a new timestamp with the current date, with millisecond precision.
<b>Signature:</b>
```typescript
static now(): Timestamp;
```
<b>Returns:</b>
[Timestamp](./firestore_lite.timestamp.md#timestamp_class)
a new timestamp representing the current date.
## Timestamp.toDate()
Converts a `Timestamp` to a JavaScript `Date` object. This conversion causes a loss of precision since `Date` objects only support millisecond precision.
<b>Signature:</b>
```typescript
toDate(): Date;
```
<b>Returns:</b>
Date
JavaScript `Date` object representing the same point in time as this `Timestamp`<!-- -->, with millisecond precision.
## Timestamp.toJSON()
Returns a JSON-serializable representation of this `Timestamp`<!-- -->.
<b>Signature:</b>
```typescript
toJSON(): {
seconds: number;
nanoseconds: number;
type: string;
};
```
<b>Returns:</b>
{ seconds: number; nanoseconds: number; type: string; }
## Timestamp.toMillis()
Converts a `Timestamp` to a numeric timestamp (in milliseconds since epoch). This operation causes a loss of precision.
<b>Signature:</b>
```typescript
toMillis(): number;
```
<b>Returns:</b>
number
The point in time corresponding to this timestamp, represented as the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
## Timestamp.toString()
Returns a textual representation of this `Timestamp`<!-- -->.
<b>Signature:</b>
```typescript
toString(): string;
```
<b>Returns:</b>
string
## Timestamp.valueOf()
Converts this object to a primitive string, which allows `Timestamp` objects to be compared using the `>`<!-- -->, `<=`<!-- -->, `>=` and `>` operators.
<b>Signature:</b>
```typescript
valueOf(): string;
```
<b>Returns:</b>
string
@@ -0,0 +1,101 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# VectorValue class
Represents a vector type in Firestore documents. Create an instance with <code>[vector()](./firestore_.md#vector_0dbdaf2)</code>.
VectorValue
<b>Signature:</b>
```typescript
export declare class VectorValue
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(json)](./firestore_lite_pipelines.vectorvalue.md#vectorvaluefromjson) | <code>static</code> | Builds a <code>VectorValue</code> instance from a JSON object created by [VectorValue.toJSON()](./firestore_.vectorvalue.md#vectorvaluetojson)<!-- -->. |
| [isEqual(other)](./firestore_lite_pipelines.vectorvalue.md#vectorvalueisequal) | | Returns <code>true</code> if the two <code>VectorValue</code> values have the same raw number arrays, returns <code>false</code> otherwise. |
| [toArray()](./firestore_lite_pipelines.vectorvalue.md#vectorvaluetoarray) | | Returns a copy of the raw number array form of the vector. |
| [toJSON()](./firestore_lite_pipelines.vectorvalue.md#vectorvaluetojson) | | Returns a JSON-serializable representation of this <code>VectorValue</code> instance. |
## VectorValue.fromJSON()
Builds a `VectorValue` instance from a JSON object created by [VectorValue.toJSON()](./firestore_.vectorvalue.md#vectorvaluetojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): VectorValue;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | a JSON object represention of a <code>VectorValue</code> instance. |
<b>Returns:</b>
[VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class)
an instance of [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## VectorValue.isEqual()
Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
<b>Signature:</b>
```typescript
isEqual(other: VectorValue): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | |
<b>Returns:</b>
boolean
## VectorValue.toArray()
Returns a copy of the raw number array form of the vector.
<b>Signature:</b>
```typescript
toArray(): number[];
```
<b>Returns:</b>
number\[\]
## VectorValue.toJSON()
Returns a JSON-serializable representation of this `VectorValue` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
a JSON representation of this object.
@@ -0,0 +1,109 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# AggregateFunction class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
A class that represents an aggregate function.
<b>Signature:</b>
```typescript
export declare class AggregateFunction
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(name, params)](./firestore_pipelines.aggregatefunction.md#aggregatefunctionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>AggregateFunction</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [exprType](./firestore_pipelines.aggregatefunction.md#aggregatefunctionexprtype) | | [ExpressionType](./firestore_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [as(name)](./firestore_pipelines.aggregatefunction.md#aggregatefunctionas) | | <b><i>(Public Preview)</i></b> Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document.
```typescript
// Calculate the average price of all items and assign it the alias "averagePrice".
firestore.pipeline().collection("items")
.aggregate(field("price").average().as("averagePrice"));
```
|
## AggregateFunction.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `AggregateFunction` class
<b>Signature:</b>
```typescript
constructor(name: string, params: Expression[]);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | |
| params | [Expression](./firestore_pipelines.expression.md#expression_class)<!-- -->\[\] | |
## AggregateFunction.exprType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
exprType: ExpressionType;
```
## AggregateFunction.as()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document.
```typescript
// Calculate the average price of all items and assign it the alias "averagePrice".
firestore.pipeline().collection("items")
.aggregate(field("price").average().as("averagePrice"));
```
<b>Signature:</b>
```typescript
as(name: string): AliasedAggregate;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | The alias to assign to this AggregateFunction. A new that wraps this AggregateFunction and associates it with the provided alias. |
<b>Returns:</b>
[AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class)
@@ -0,0 +1,78 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# AliasedAggregate class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An AggregateFunction with alias.
<b>Signature:</b>
```typescript
export declare class AliasedAggregate
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(aggregate, alias, \_methodName)](./firestore_pipelines.aliasedaggregate.md#aliasedaggregateconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>AliasedAggregate</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [aggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregateaggregate) | | [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) | <b><i>(Public Preview)</i></b> |
| [alias](./firestore_pipelines.aliasedaggregate.md#aliasedaggregatealias) | | string | <b><i>(Public Preview)</i></b> |
## AliasedAggregate.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `AliasedAggregate` class
<b>Signature:</b>
```typescript
constructor(aggregate: AggregateFunction, alias: string, _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| aggregate | [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) | |
| alias | string | |
| \_methodName | string \| undefined | |
## AliasedAggregate.aggregate
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly aggregate: AggregateFunction;
```
## AliasedAggregate.alias
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly alias: string;
```
@@ -0,0 +1,102 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# AliasedExpression class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
export declare class AliasedExpression implements Selectable
```
<b>Implements:</b> [Selectable](./firestore_pipelines.selectable.md#selectable_interface)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(expr, alias, \_methodName)](./firestore_pipelines.aliasedexpression.md#aliasedexpressionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>AliasedExpression</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [alias](./firestore_pipelines.aliasedexpression.md#aliasedexpressionalias) | | string | <b><i>(Public Preview)</i></b> |
| [expr](./firestore_pipelines.aliasedexpression.md#aliasedexpressionexpr) | | [Expression](./firestore_pipelines.expression.md#expression_class) | <b><i>(Public Preview)</i></b> |
| [exprType](./firestore_pipelines.aliasedexpression.md#aliasedexpressionexprtype) | | [ExpressionType](./firestore_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
| [selectable](./firestore_pipelines.aliasedexpression.md#aliasedexpressionselectable) | | true | <b><i>(Public Preview)</i></b> |
## AliasedExpression.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `AliasedExpression` class
<b>Signature:</b>
```typescript
constructor(expr: Expression, alias: string, _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | |
| alias | string | |
| \_methodName | string \| undefined | |
## AliasedExpression.alias
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly alias: string;
```
## AliasedExpression.expr
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expr: Expression;
```
## AliasedExpression.exprType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
exprType: ExpressionType;
```
## AliasedExpression.selectable
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
selectable: true;
```
@@ -0,0 +1,274 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# BooleanExpression class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An interface that represents a filter condition.
<b>Signature:</b>
```typescript
export declare abstract class BooleanExpression extends Expression
```
<b>Extends:</b> [Expression](./firestore_pipelines.expression.md#expression_class)
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [conditional(thenExpr, elseExpr)](./firestore_pipelines.booleanexpression.md#booleanexpressionconditional) | | <b><i>(Public Preview)</i></b> Creates a conditional expression that evaluates to the 'then' expression if <code>this</code> expression evaluates to <code>true</code>, or evaluates to the 'else' expression if <code>this</code> expressions evaluates <code>false</code>.
```typescript
// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor".
field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor"));
```
|
| [countIf()](./firestore_pipelines.booleanexpression.md#booleanexpressioncountif) | | <b><i>(Public Preview)</i></b> Creates an aggregation that finds the count of input documents satisfying this boolean expression.
```typescript
// Find the count of documents with a score greater than 90
field("score").greaterThan(90).countIf().as("highestScore");
```
A new <code>AggregateFunction</code> representing the 'countIf' aggregation. |
| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(constant(false));
```
|
| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(false);
```
|
| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(constant(0));
```
|
| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | <b><i>(Public Preview)</i></b> Creates an expression that returns the <code>catch</code> argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(0);
```
|
| [not()](./firestore_pipelines.booleanexpression.md#booleanexpressionnot) | | <b><i>(Public Preview)</i></b> Creates an expression that negates this boolean expression.
```typescript
// Find documents where the 'tags' field does not contain 'completed'
field("tags").arrayContains("completed").not();
```
A new representing the negated filter condition. |
## BooleanExpression.conditional()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates a conditional expression that evaluates to the 'then' expression if `this` expression evaluates to `true`<!-- -->, or evaluates to the 'else' expression if `this` expressions evaluates `false`<!-- -->.
```typescript
// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor".
field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor"));
```
<b>Signature:</b>
```typescript
conditional(thenExpr: Expression, elseExpr: Expression): FunctionExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| thenExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is true. |
| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. A new representing the conditional expression. |
<b>Returns:</b>
[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class)
## BooleanExpression.countIf()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an aggregation that finds the count of input documents satisfying this boolean expression.
```typescript
// Find the count of documents with a score greater than 90
field("score").greaterThan(90).countIf().as("highestScore");
```
A new `AggregateFunction` representing the 'countIf' aggregation.
<b>Signature:</b>
```typescript
countIf(): AggregateFunction;
```
<b>Returns:</b>
[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(constant(false));
```
<b>Signature:</b>
```typescript
ifError(catchValue: BooleanExpression): BooleanExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error
// but always returns a boolean expression.
constant(50).divide('length').gt(1).ifError(false);
```
<b>Signature:</b>
```typescript
ifError(catchValue: boolean): BooleanExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | boolean | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(constant(0));
```
<b>Signature:</b>
```typescript
ifError(catchValue: Expression): FunctionExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | [Expression](./firestore_pipelines.expression.md#expression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class)
## BooleanExpression.ifError()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression.
```typescript
// Create an expression that protects against a divide by zero error.
constant(50).divide('length').gt(1).ifError(0);
```
<b>Signature:</b>
```typescript
ifError(catchValue: unknown): FunctionExpression;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| catchValue | unknown | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. |
<b>Returns:</b>
[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class)
## BooleanExpression.not()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Creates an expression that negates this boolean expression.
```typescript
// Find documents where the 'tags' field does not contain 'completed'
field("tags").arrayContains("completed").not();
```
A new representing the negated filter condition.
<b>Signature:</b>
```typescript
not(): BooleanExpression;
```
<b>Returns:</b>
[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)
+177
View File
@@ -0,0 +1,177 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Bytes class
An immutable object representing an array of bytes.
<b>Signature:</b>
```typescript
export declare class Bytes
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromBase64String(base64)](./firestore_pipelines.bytes.md#bytesfrombase64string) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Base64 string, converting it to bytes. |
| [fromJSON(json)](./firestore_pipelines.bytes.md#bytesfromjson) | <code>static</code> | Builds a <code>Bytes</code> instance from a JSON object created by [Bytes.toJSON()](./firestore_.bytes.md#bytestojson)<!-- -->. |
| [fromUint8Array(array)](./firestore_pipelines.bytes.md#bytesfromuint8array) | <code>static</code> | Creates a new <code>Bytes</code> object from the given Uint8Array. |
| [isEqual(other)](./firestore_pipelines.bytes.md#bytesisequal) | | Returns true if this <code>Bytes</code> object is equal to the provided one. |
| [toBase64()](./firestore_pipelines.bytes.md#bytestobase64) | | Returns the underlying bytes as a Base64-encoded string. |
| [toJSON()](./firestore_pipelines.bytes.md#bytestojson) | | Returns a JSON-serializable representation of this <code>Bytes</code> instance. |
| [toString()](./firestore_pipelines.bytes.md#bytestostring) | | Returns a string representation of the <code>Bytes</code> object. |
| [toUint8Array()](./firestore_pipelines.bytes.md#bytestouint8array) | | Returns the underlying bytes in a new <code>Uint8Array</code>. |
## Bytes.fromBase64String()
Creates a new `Bytes` object from the given Base64 string, converting it to bytes.
<b>Signature:</b>
```typescript
static fromBase64String(base64: string): Bytes;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| base64 | string | The Base64 string used to create the <code>Bytes</code> object. |
<b>Returns:</b>
[Bytes](./firestore_.bytes.md#bytes_class)
## Bytes.fromJSON()
Builds a `Bytes` instance from a JSON object created by [Bytes.toJSON()](./firestore_.bytes.md#bytestojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): Bytes;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | a JSON object represention of a <code>Bytes</code> instance |
<b>Returns:</b>
[Bytes](./firestore_.bytes.md#bytes_class)
an instance of [Bytes](./firestore_.bytes.md#bytes_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## Bytes.fromUint8Array()
Creates a new `Bytes` object from the given Uint8Array.
<b>Signature:</b>
```typescript
static fromUint8Array(array: Uint8Array): Bytes;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| array | Uint8Array | The Uint8Array used to create the <code>Bytes</code> object. |
<b>Returns:</b>
[Bytes](./firestore_.bytes.md#bytes_class)
## Bytes.isEqual()
Returns true if this `Bytes` object is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: Bytes): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [Bytes](./firestore_.bytes.md#bytes_class) | The <code>Bytes</code> object to compare against. |
<b>Returns:</b>
boolean
true if this `Bytes` object is equal to the provided one.
## Bytes.toBase64()
Returns the underlying bytes as a Base64-encoded string.
<b>Signature:</b>
```typescript
toBase64(): string;
```
<b>Returns:</b>
string
The Base64-encoded string created from the `Bytes` object.
## Bytes.toJSON()
Returns a JSON-serializable representation of this `Bytes` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
a JSON representation of this object.
## Bytes.toString()
Returns a string representation of the `Bytes` object.
<b>Signature:</b>
```typescript
toString(): string;
```
<b>Returns:</b>
string
A string representation of the `Bytes` object.
## Bytes.toUint8Array()
Returns the underlying bytes in a new `Uint8Array`<!-- -->.
<b>Signature:</b>
```typescript
toUint8Array(): Uint8Array;
```
<b>Returns:</b>
Uint8Array
The Uint8Array created from the `Bytes` object.
@@ -0,0 +1,121 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# CollectionReference class
A `CollectionReference` object can be used for adding documents, getting document references, and querying for documents (using [query()](./firestore_.md#query_9f7b0f4)<!-- -->).
<b>Signature:</b>
```typescript
export declare class CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends Query<AppModelType, DbModelType>
```
<b>Extends:</b> [Query](./firestore_.query.md#query_class)<!-- -->&lt;AppModelType, DbModelType&gt;
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [id](./firestore_pipelines.collectionreference.md#collectionreferenceid) | | string | The collection's identifier. |
| [parent](./firestore_pipelines.collectionreference.md#collectionreferenceparent) | | [DocumentReference](./firestore_.documentreference.md#documentreference_class)<!-- -->&lt;[DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->&gt; \| null | A reference to the containing <code>DocumentReference</code> if this is a subcollection. If this isn't a subcollection, the reference is null. |
| [path](./firestore_pipelines.collectionreference.md#collectionreferencepath) | | string | A string representing the path of the referenced collection (relative to the root of the database). |
| [type](./firestore_pipelines.collectionreference.md#collectionreferencetype) | | (not declared) | The type of this Firestore reference. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [withConverter(converter)](./firestore_pipelines.collectionreference.md#collectionreferencewithconverter) | | Applies a custom data converter to this <code>CollectionReference</code>, allowing you to use your own custom model objects with Firestore. When you call [addDoc()](./firestore_.md#adddoc_6e783ff) with the returned <code>CollectionReference</code> instance, the provided converter will convert between Firestore data of type <code>NewDbModelType</code> and your custom type <code>NewAppModelType</code>. |
| [withConverter(converter)](./firestore_pipelines.collectionreference.md#collectionreferencewithconverter) | | Removes the current converter. |
## CollectionReference.id
The collection's identifier.
<b>Signature:</b>
```typescript
get id(): string;
```
## CollectionReference.parent
A reference to the containing `DocumentReference` if this is a subcollection. If this isn't a subcollection, the reference is null.
<b>Signature:</b>
```typescript
get parent(): DocumentReference<DocumentData, DocumentData> | null;
```
## CollectionReference.path
A string representing the path of the referenced collection (relative to the root of the database).
<b>Signature:</b>
```typescript
get path(): string;
```
## CollectionReference.type
The type of this Firestore reference.
<b>Signature:</b>
```typescript
readonly type = "collection";
```
## CollectionReference.withConverter()
Applies a custom data converter to this `CollectionReference`<!-- -->, allowing you to use your own custom model objects with Firestore. When you call [addDoc()](./firestore_.md#adddoc_6e783ff) with the returned `CollectionReference` instance, the provided converter will convert between Firestore data of type `NewDbModelType` and your custom type `NewAppModelType`<!-- -->.
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[CollectionReference](./firestore_.collectionreference.md#collectionreference_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
A `CollectionReference` that uses the provided converter.
## CollectionReference.withConverter()
Removes the current converter.
<b>Signature:</b>
```typescript
withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | null | <code>null</code> removes the current converter. |
<b>Returns:</b>
[CollectionReference](./firestore_.collectionreference.md#collectionreference_class)<!-- -->&lt;[DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->&gt;
A `CollectionReference<DocumentData, DocumentData>` that does not use a converter.
@@ -0,0 +1,19 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# DocumentData interface
Document data (for use with [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->) consists of fields mapped to values.
<b>Signature:</b>
```typescript
export declare interface DocumentData
```
@@ -0,0 +1,207 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# DocumentReference class
A `DocumentReference` refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist.
<b>Signature:</b>
```typescript
export declare class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>
```
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [converter](./firestore_pipelines.documentreference.md#documentreferenceconverter) | | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;AppModelType, DbModelType&gt; \| null | If provided, the <code>FirestoreDataConverter</code> associated with this instance. |
| [firestore](./firestore_pipelines.documentreference.md#documentreferencefirestore) | | [Firestore](./firestore_.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the document is in. This is useful for performing transactions, for example. |
| [id](./firestore_pipelines.documentreference.md#documentreferenceid) | | string | The document's identifier within its collection. |
| [parent](./firestore_pipelines.documentreference.md#documentreferenceparent) | | [CollectionReference](./firestore_.collectionreference.md#collectionreference_class)<!-- -->&lt;AppModelType, DbModelType&gt; | The collection this <code>DocumentReference</code> belongs to. |
| [path](./firestore_pipelines.documentreference.md#documentreferencepath) | | string | A string representing the path of the referenced document (relative to the root of the database). |
| [type](./firestore_pipelines.documentreference.md#documentreferencetype) | | (not declared) | The type of this Firestore reference. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(firestore, json)](./firestore_pipelines.documentreference.md#documentreferencefromjson) | <code>static</code> | Builds a <code>DocumentReference</code> instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->. |
| [fromJSON(firestore, json, converter)](./firestore_pipelines.documentreference.md#documentreferencefromjson) | <code>static</code> | Builds a <code>DocumentReference</code> instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->. |
| [toJSON()](./firestore_pipelines.documentreference.md#documentreferencetojson) | | Returns a JSON-serializable representation of this <code>DocumentReference</code> instance. |
| [withConverter(converter)](./firestore_pipelines.documentreference.md#documentreferencewithconverter) | | Applies a custom data converter to this <code>DocumentReference</code>, allowing you to use your own custom model objects with Firestore. When you call [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, [getDoc()](./firestore_lite.md#getdoc_4569087)<!-- -->, etc. with the returned <code>DocumentReference</code> instance, the provided converter will convert between Firestore data of type <code>NewDbModelType</code> and your custom type <code>NewAppModelType</code>. |
| [withConverter(converter)](./firestore_pipelines.documentreference.md#documentreferencewithconverter) | | Removes the current converter. |
## DocumentReference.converter
If provided, the `FirestoreDataConverter` associated with this instance.
<b>Signature:</b>
```typescript
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
```
## DocumentReference.firestore
The [Firestore](./firestore_.firestore.md#firestore_class) instance the document is in. This is useful for performing transactions, for example.
<b>Signature:</b>
```typescript
readonly firestore: Firestore;
```
## DocumentReference.id
The document's identifier within its collection.
<b>Signature:</b>
```typescript
get id(): string;
```
## DocumentReference.parent
The collection this `DocumentReference` belongs to.
<b>Signature:</b>
```typescript
get parent(): CollectionReference<AppModelType, DbModelType>;
```
## DocumentReference.path
A string representing the path of the referenced document (relative to the root of the database).
<b>Signature:</b>
```typescript
get path(): string;
```
## DocumentReference.type
The type of this Firestore reference.
<b>Signature:</b>
```typescript
readonly type = "document";
```
## DocumentReference.fromJSON()
Builds a `DocumentReference` instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(firestore: Firestore, json: object): DocumentReference;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| firestore | [Firestore](./firestore_.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the snapshot should be loaded for. |
| json | object | a JSON object represention of a <code>DocumentReference</code> instance |
<b>Returns:</b>
[DocumentReference](./firestore_.documentreference.md#documentreference_class)
an instance of [DocumentReference](./firestore_.documentreference.md#documentreference_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## DocumentReference.fromJSON()
Builds a `DocumentReference` instance from a JSON object created by [DocumentReference.toJSON()](./firestore_.documentreference.md#documentreferencetojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON<NewAppModelType = DocumentData, NewDbModelType extends DocumentData = DocumentData>(firestore: Firestore, json: object, converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| firestore | [Firestore](./firestore_.firestore.md#firestore_class) | The [Firestore](./firestore_.firestore.md#firestore_class) instance the snapshot should be loaded for. |
| json | object | a JSON object represention of a <code>DocumentReference</code> instance |
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[DocumentReference](./firestore_.documentreference.md#documentreference_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
an instance of [DocumentReference](./firestore_.documentreference.md#documentreference_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## DocumentReference.toJSON()
Returns a JSON-serializable representation of this `DocumentReference` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
a JSON representation of this object.
## DocumentReference.withConverter()
Applies a custom data converter to this `DocumentReference`<!-- -->, allowing you to use your own custom model objects with Firestore. When you call [setDoc()](./firestore_lite.md#setdoc_ee215ad)<!-- -->, [getDoc()](./firestore_lite.md#getdoc_4569087)<!-- -->, etc. with the returned `DocumentReference` instance, the provided converter will convert between Firestore data of type `NewDbModelType` and your custom type `NewAppModelType`<!-- -->.
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[DocumentReference](./firestore_.documentreference.md#documentreference_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
A `DocumentReference` that uses the provided converter.
## DocumentReference.withConverter()
Removes the current converter.
<b>Signature:</b>
```typescript
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | null | <code>null</code> removes the current converter. |
<b>Returns:</b>
[DocumentReference](./firestore_.documentreference.md#documentreference_class)<!-- -->&lt;[DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->&gt;
A `DocumentReference<DocumentData, DocumentData>` that does not use a converter.
@@ -0,0 +1,162 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# DocumentSnapshot class
A `DocumentSnapshot` contains data read from a document in your Firestore database. The data can be extracted with `.data()` or `.get(<field>)` to get a specific field.
For a `DocumentSnapshot` that points to a non-existing document, any data access will return 'undefined'. You can use the `exists()` method to explicitly verify a document's existence.
<b>Signature:</b>
```typescript
export declare class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)()](./firestore_pipelines.documentsnapshot.md#documentsnapshotconstructor) | | Constructs a new instance of the <code>DocumentSnapshot</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [id](./firestore_pipelines.documentsnapshot.md#documentsnapshotid) | | string | Property of the <code>DocumentSnapshot</code> that provides the document's ID. |
| [metadata](./firestore_pipelines.documentsnapshot.md#documentsnapshotmetadata) | | [SnapshotMetadata](./firestore_.snapshotmetadata.md#snapshotmetadata_class) | Metadata about the <code>DocumentSnapshot</code>, including information about its source and local modifications. |
| [ref](./firestore_pipelines.documentsnapshot.md#documentsnapshotref) | | [DocumentReference](./firestore_.documentreference.md#documentreference_class)<!-- -->&lt;AppModelType, DbModelType&gt; | The <code>DocumentReference</code> for the document included in the <code>DocumentSnapshot</code>. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [data(options)](./firestore_pipelines.documentsnapshot.md#documentsnapshotdata) | | Retrieves all fields in the document as an <code>Object</code>. Returns <code>undefined</code> if the document doesn't exist.<!-- -->By default, <code>serverTimestamp()</code> values that have not yet been set to their final value will be returned as <code>null</code>. You can override this by passing an options object. |
| [exists()](./firestore_pipelines.documentsnapshot.md#documentsnapshotexists) | | Returns whether or not the data exists. True if the document exists. |
| [get(fieldPath, options)](./firestore_pipelines.documentsnapshot.md#documentsnapshotget) | | Retrieves the field specified by <code>fieldPath</code>. Returns <code>undefined</code> if the document or field doesn't exist.<!-- -->By default, a <code>serverTimestamp()</code> that has not yet been set to its final value will be returned as <code>null</code>. You can override this by passing an options object. |
| [toJSON()](./firestore_pipelines.documentsnapshot.md#documentsnapshottojson) | | Returns a JSON-serializable representation of this <code>DocumentSnapshot</code> instance. |
## DocumentSnapshot.(constructor)
Constructs a new instance of the `DocumentSnapshot` class
<b>Signature:</b>
```typescript
protected constructor();
```
## DocumentSnapshot.id
Property of the `DocumentSnapshot` that provides the document's ID.
<b>Signature:</b>
```typescript
get id(): string;
```
## DocumentSnapshot.metadata
Metadata about the `DocumentSnapshot`<!-- -->, including information about its source and local modifications.
<b>Signature:</b>
```typescript
readonly metadata: SnapshotMetadata;
```
## DocumentSnapshot.ref
The `DocumentReference` for the document included in the `DocumentSnapshot`<!-- -->.
<b>Signature:</b>
```typescript
get ref(): DocumentReference<AppModelType, DbModelType>;
```
## DocumentSnapshot.data()
Retrieves all fields in the document as an `Object`<!-- -->. Returns `undefined` if the document doesn't exist.
By default, `serverTimestamp()` values that have not yet been set to their final value will be returned as `null`<!-- -->. You can override this by passing an options object.
<b>Signature:</b>
```typescript
data(options?: SnapshotOptions): AppModelType | undefined;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [SnapshotOptions](./firestore_.snapshotoptions.md#snapshotoptions_interface) | An options object to configure how data is retrieved from the snapshot (for example the desired behavior for server timestamps that have not yet been set to their final value). |
<b>Returns:</b>
AppModelType \| undefined
An `Object` containing all fields in the document or `undefined` if the document doesn't exist.
## DocumentSnapshot.exists()
Returns whether or not the data exists. True if the document exists.
<b>Signature:</b>
```typescript
exists(): this is QueryDocumentSnapshot<AppModelType, DbModelType>;
```
<b>Returns:</b>
this is [QueryDocumentSnapshot](./firestore_.querydocumentsnapshot.md#querydocumentsnapshot_class)<!-- -->&lt;AppModelType, DbModelType&gt;
## DocumentSnapshot.get()
Retrieves the field specified by `fieldPath`<!-- -->. Returns `undefined` if the document or field doesn't exist.
By default, a `serverTimestamp()` that has not yet been set to its final value will be returned as `null`<!-- -->. You can override this by passing an options object.
<b>Signature:</b>
```typescript
get(fieldPath: string | FieldPath, options?: SnapshotOptions): any;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldPath | string \| [FieldPath](./firestore_.fieldpath.md#fieldpath_class) | The path (for example 'foo' or 'foo.bar') to a specific field. |
| options | [SnapshotOptions](./firestore_.snapshotoptions.md#snapshotoptions_interface) | An options object to configure how the field is retrieved from the snapshot (for example the desired behavior for server timestamps that have not yet been set to their final value). |
<b>Returns:</b>
any
The data at the specified field location or undefined if no such field exists in the document.
## DocumentSnapshot.toJSON()
Returns a JSON-serializable representation of this `DocumentSnapshot` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
a JSON representation of this object. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if this `DocumentSnapshot` has pending writes.
File diff suppressed because it is too large Load Diff
+103
View File
@@ -0,0 +1,103 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Field class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Represents a reference to a field in a Firestore document, or outputs of a stage.
<p>Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.
<p>You can create a `Field` instance using the static method:
```typescript
// Create a Field instance for the 'name' field
const nameField = field("name");
// Create a Field instance for a nested field 'address.city'
const cityField = field("address.city");
```
<b>Signature:</b>
```typescript
export declare class Field extends Expression implements Selectable
```
<b>Extends:</b> [Expression](./firestore_pipelines.expression.md#expression_class)
<b>Implements:</b> [Selectable](./firestore_pipelines.selectable.md#selectable_interface)
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [alias](./firestore_pipelines.field.md#fieldalias) | | string | <b><i>(Public Preview)</i></b> |
| [expr](./firestore_pipelines.field.md#fieldexpr) | | [Expression](./firestore_pipelines.expression.md#expression_class) | <b><i>(Public Preview)</i></b> |
| [expressionType](./firestore_pipelines.field.md#fieldexpressiontype) | | [ExpressionType](./firestore_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
| [fieldName](./firestore_pipelines.field.md#fieldfieldname) | | string | <b><i>(Public Preview)</i></b> |
| [selectable](./firestore_pipelines.field.md#fieldselectable) | | true | <b><i>(Public Preview)</i></b> |
## Field.alias
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
get alias(): string;
```
## Field.expr
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
get expr(): Expression;
```
## Field.expressionType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expressionType: ExpressionType;
```
## Field.fieldName
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
get fieldName(): string;
```
## Field.selectable
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
selectable: true;
```
@@ -0,0 +1,72 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FieldPath class
A `FieldPath` refers to a field in a document. The path may consist of a single field name (referring to a top-level field in the document), or a list of field names (referring to a nested field in the document).
Create a `FieldPath` by providing field names. If more than one field name is provided, the path will point to a nested field in a document.
<b>Signature:</b>
```typescript
export declare class FieldPath
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(fieldNames)](./firestore_pipelines.fieldpath.md#fieldpathconstructor) | | Creates a <code>FieldPath</code> from the provided field names. If more than one field name is provided, the path will point to a nested field in a document. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [isEqual(other)](./firestore_pipelines.fieldpath.md#fieldpathisequal) | | Returns true if this <code>FieldPath</code> is equal to the provided one. |
## FieldPath.(constructor)
Creates a `FieldPath` from the provided field names. If more than one field name is provided, the path will point to a nested field in a document.
<b>Signature:</b>
```typescript
constructor(...fieldNames: string[]);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldNames | string\[\] | A list of field names. |
## FieldPath.isEqual()
Returns true if this `FieldPath` is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: FieldPath): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [FieldPath](./firestore_.fieldpath.md#fieldpath_class) | The <code>FieldPath</code> to compare against. |
<b>Returns:</b>
boolean
true if this `FieldPath` is equal to the provided one.
@@ -0,0 +1,46 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FieldValue class
Sentinel values that can be used when writing document fields with `set()` or `update()`<!-- -->.
<b>Signature:</b>
```typescript
export declare abstract class FieldValue
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [isEqual(other)](./firestore_pipelines.fieldvalue.md#fieldvalueisequal) | | Compares <code>FieldValue</code>s for equality. |
## FieldValue.isEqual()
Compares `FieldValue`<!-- -->s for equality.
<b>Signature:</b>
```typescript
abstract isEqual(other: FieldValue): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [FieldValue](./firestore_.fieldvalue.md#fieldvalue_class) | |
<b>Returns:</b>
boolean
@@ -0,0 +1,68 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Firestore class
The Cloud Firestore service interface.
Do not call this constructor directly. Instead, use [getFirestore()](./firestore_.md#getfirestore)<!-- -->.
<b>Signature:</b>
```typescript
export declare class Firestore
```
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [app](./firestore_pipelines.firestore.md#firestoreapp) | | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) associated with this <code>Firestore</code> service instance. |
| [type](./firestore_pipelines.firestore.md#firestoretype) | | 'firestore-lite' \| 'firestore' | Whether it's a [Firestore](./firestore_.firestore.md#firestore_class) or Firestore Lite instance. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [toJSON()](./firestore_pipelines.firestore.md#firestoretojson) | | Returns a JSON-serializable representation of this <code>Firestore</code> instance. |
## Firestore.app
The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) associated with this `Firestore` service instance.
<b>Signature:</b>
```typescript
get app(): FirebaseApp;
```
## Firestore.type
Whether it's a [Firestore](./firestore_.firestore.md#firestore_class) or Firestore Lite instance.
<b>Signature:</b>
```typescript
type: 'firestore-lite' | 'firestore';
```
## Firestore.toJSON()
Returns a JSON-serializable representation of this `Firestore` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
@@ -0,0 +1,264 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FirestoreDataConverter interface
Converter used by `withConverter()` to transform user objects of type `AppModelType` into Firestore data of type `DbModelType`<!-- -->.
Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore.
In this context, an "AppModel" is a class that is used in an application to package together related information and functionality. Such a class could, for example, have properties with complex, nested data types, properties used for memoization, properties of types not supported by Firestore (such as `symbol` and `bigint`<!-- -->), and helper functions that perform compound operations. Such classes are not suitable and/or possible to store into a Firestore database. Instead, instances of such classes need to be converted to "plain old JavaScript objects" (POJOs) with exclusively primitive properties, potentially nested inside other POJOs or arrays of POJOs. In this context, this type is referred to as the "DbModel" and would be an object suitable for persisting into Firestore. For convenience, applications can implement `FirestoreDataConverter` and register the converter with Firestore objects, such as `DocumentReference` or `Query`<!-- -->, to automatically convert `AppModel` to `DbModel` when storing into Firestore, and convert `DbModel` to `AppModel` when retrieving from Firestore.
<b>Signature:</b>
```typescript
export declare interface FirestoreDataConverter<AppModelType, DbModelType extends DocumentData = DocumentData>
```
## Methods
| Method | Description |
| --- | --- |
| [fromFirestore(snapshot, options)](./firestore_pipelines.firestoredataconverter.md#firestoredataconverterfromfirestore) | Called by the Firestore SDK to convert Firestore data into an object of type <code>AppModelType</code>. You can access your data by calling: <code>snapshot.data(options)</code>.<!-- -->Generally, the data returned from <code>snapshot.data()</code> can be cast to <code>DbModelType</code>; however, this is not guaranteed because Firestore does not enforce a schema on the database. For example, writes from a previous version of the application or writes from another client that did not use a type converter could have written data with different properties and/or property types. The implementation will need to choose whether to gracefully recover from non-conforming data or throw an error.<!-- -->To override this method, see . |
| [toFirestore(modelObject)](./firestore_pipelines.firestoredataconverter.md#firestoredataconvertertofirestore) | Called by the Firestore SDK to convert a custom model object of type <code>AppModelType</code> into a plain JavaScript object (suitable for writing directly to the Firestore database) of type <code>DbModelType</code>. To use <code>set()</code> with <code>merge</code> and <code>mergeFields</code>, <code>toFirestore()</code> must be defined with <code>PartialWithFieldValue&lt;AppModelType&gt;</code>.<!-- -->The <code>WithFieldValue&lt;T&gt;</code> type extends <code>T</code> to also allow FieldValues such as [deleteField()](./firestore_.md#deletefield) to be used as property values. |
| [toFirestore(modelObject, options)](./firestore_pipelines.firestoredataconverter.md#firestoredataconvertertofirestore) | Called by the Firestore SDK to convert a custom model object of type <code>AppModelType</code> into a plain JavaScript object (suitable for writing directly to the Firestore database) of type <code>DbModelType</code>. Used with [setDoc()](./firestore_.md#setdoc_ee215ad)<!-- -->, and with <code>merge:true</code> or <code>mergeFields</code>.<!-- -->The <code>PartialWithFieldValue&lt;T&gt;</code> type extends <code>Partial&lt;T&gt;</code> to allow FieldValues such as [arrayUnion()](./firestore_.md#arrayunion_7d853aa) to be used as property values. It also supports nested <code>Partial</code> by allowing nested fields to be omitted. |
## FirestoreDataConverter.fromFirestore()
Called by the Firestore SDK to convert Firestore data into an object of type `AppModelType`<!-- -->. You can access your data by calling: `snapshot.data(options)`<!-- -->.
Generally, the data returned from `snapshot.data()` can be cast to `DbModelType`<!-- -->; however, this is not guaranteed because Firestore does not enforce a schema on the database. For example, writes from a previous version of the application or writes from another client that did not use a type converter could have written data with different properties and/or property types. The implementation will need to choose whether to gracefully recover from non-conforming data or throw an error.
To override this method, see .
<b>Signature:</b>
```typescript
fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData, DocumentData>, options?: SnapshotOptions): AppModelType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| snapshot | [QueryDocumentSnapshot](./firestore_.querydocumentsnapshot.md#querydocumentsnapshot_class)<!-- -->&lt;[DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->&gt; | A <code>QueryDocumentSnapshot</code> containing your data and metadata. |
| options | [SnapshotOptions](./firestore_.snapshotoptions.md#snapshotoptions_interface) | The <code>SnapshotOptions</code> from the initial call to <code>data()</code>. |
<b>Returns:</b>
AppModelType
## FirestoreDataConverter.toFirestore()
Called by the Firestore SDK to convert a custom model object of type `AppModelType` into a plain JavaScript object (suitable for writing directly to the Firestore database) of type `DbModelType`<!-- -->. To use `set()` with `merge` and `mergeFields`<!-- -->, `toFirestore()` must be defined with `PartialWithFieldValue<AppModelType>`<!-- -->.
The `WithFieldValue<T>` type extends `T` to also allow FieldValues such as [deleteField()](./firestore_.md#deletefield) to be used as property values.
<b>Signature:</b>
```typescript
toFirestore(modelObject: WithFieldValue<AppModelType>): WithFieldValue<DbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| modelObject | [WithFieldValue](./firestore_.md#withfieldvalue)<!-- -->&lt;AppModelType&gt; | |
<b>Returns:</b>
[WithFieldValue](./firestore_.md#withfieldvalue)<!-- -->&lt;DbModelType&gt;
## FirestoreDataConverter.toFirestore()
Called by the Firestore SDK to convert a custom model object of type `AppModelType` into a plain JavaScript object (suitable for writing directly to the Firestore database) of type `DbModelType`<!-- -->. Used with [setDoc()](./firestore_.md#setdoc_ee215ad)<!-- -->, and with `merge:true` or `mergeFields`<!-- -->.
The `PartialWithFieldValue<T>` type extends `Partial<T>` to allow FieldValues such as [arrayUnion()](./firestore_.md#arrayunion_7d853aa) to be used as property values. It also supports nested `Partial` by allowing nested fields to be omitted.
<b>Signature:</b>
```typescript
toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOptions): PartialWithFieldValue<DbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| modelObject | [PartialWithFieldValue](./firestore_.md#partialwithfieldvalue)<!-- -->&lt;AppModelType&gt; | |
| options | [SetOptions](./firestore_.md#setoptions) | |
<b>Returns:</b>
[PartialWithFieldValue](./firestore_.md#partialwithfieldvalue)<!-- -->&lt;DbModelType&gt;
### Example
Simple Example
```typescript
const numberConverter = {
toFirestore(value: WithFieldValue<number>) {
return { value };
},
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) {
return snapshot.data(options).value as number;
}
};
async function simpleDemo(db: Firestore): Promise<void> {
const documentRef = doc(db, 'values/value123').withConverter(numberConverter);
// converters are used with `setDoc`, `addDoc`, and `getDoc`
await setDoc(documentRef, 42);
const snapshot1 = await getDoc(documentRef);
assertEqual(snapshot1.data(), 42);
// converters are not used when writing data with `updateDoc`
await updateDoc(documentRef, { value: 999 });
const snapshot2 = await getDoc(documentRef);
assertEqual(snapshot2.data(), 999);
}
```
Advanced Example
```typescript
// The Post class is a model that is used by our application.
// This class may have properties and methods that are specific
// to our application execution, which do not need to be persisted
// to Firestore.
class Post {
constructor(
readonly title: string,
readonly author: string,
readonly lastUpdatedMillis: number
) {}
toString(): string {
return `${this.title} by ${this.author}`;
}
}
// The PostDbModel represents how we want our posts to be stored
// in Firestore. This DbModel has different properties (`ttl`,
// `aut`, and `lut`) from the Post class we use in our application.
interface PostDbModel {
ttl: string;
aut: { firstName: string; lastName: string };
lut: Timestamp;
}
// The `PostConverter` implements `FirestoreDataConverter` and specifies
// how the Firestore SDK can convert `Post` objects to `PostDbModel`
// objects and vice versa.
class PostConverter implements FirestoreDataConverter<Post, PostDbModel> {
toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> {
return {
ttl: post.title,
aut: this._autFromAuthor(post.author),
lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis)
};
}
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post {
const data = snapshot.data(options) as PostDbModel;
const author = `${data.aut.firstName} ${data.aut.lastName}`;
return new Post(data.ttl, author, data.lut.toMillis());
}
_autFromAuthor(
author: string | FieldValue
): { firstName: string; lastName: string } | FieldValue {
if (typeof author !== 'string') {
// `author` is a FieldValue, so just return it.
return author;
}
const [firstName, lastName] = author.split(' ');
return {firstName, lastName};
}
_lutFromLastUpdatedMillis(
lastUpdatedMillis: number | FieldValue
): Timestamp | FieldValue {
if (typeof lastUpdatedMillis !== 'number') {
// `lastUpdatedMillis` must be a FieldValue, so just return it.
return lastUpdatedMillis;
}
return Timestamp.fromMillis(lastUpdatedMillis);
}
}
async function advancedDemo(db: Firestore): Promise<void> {
// Create a `DocumentReference` with a `FirestoreDataConverter`.
const documentRef = doc(db, 'posts/post123').withConverter(new PostConverter());
// The `data` argument specified to `setDoc()` is type checked by the
// TypeScript compiler to be compatible with `Post`. Since the `data`
// argument is typed as `WithFieldValue<Post>` rather than just `Post`,
// this allows properties of the `data` argument to also be special
// Firestore values that perform server-side mutations, such as
// `arrayRemove()`, `deleteField()`, and `serverTimestamp()`.
await setDoc(documentRef, {
title: 'My Life',
author: 'Foo Bar',
lastUpdatedMillis: serverTimestamp()
});
// The TypeScript compiler will fail to compile if the `data` argument to
// `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This
// type checking prevents the caller from specifying objects with incorrect
// properties or property values.
// @ts-expect-error "Argument of type { ttl: string; } is not assignable
// to parameter of type WithFieldValue<Post>"
await setDoc(documentRef, { ttl: 'The Title' });
// When retrieving a document with `getDoc()` the `DocumentSnapshot`
// object's `data()` method returns a `Post`, rather than a generic object,
// which would have been returned if the `DocumentReference` did _not_ have a
// `FirestoreDataConverter` attached to it.
const snapshot1: DocumentSnapshot<Post> = await getDoc(documentRef);
const post1: Post = snapshot1.data()!;
if (post1) {
assertEqual(post1.title, 'My Life');
assertEqual(post1.author, 'Foo Bar');
}
// The `data` argument specified to `updateDoc()` is type checked by the
// TypeScript compiler to be compatible with `PostDbModel`. Note that
// unlike `setDoc()`, whose `data` argument must be compatible with `Post`,
// the `data` argument to `updateDoc()` must be compatible with
// `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed
// as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this
// allows properties of the `data` argument to also be those special
// Firestore values, like `arrayRemove()`, `deleteField()`, and
// `serverTimestamp()`.
await updateDoc(documentRef, {
'aut.firstName': 'NewFirstName',
lut: serverTimestamp()
});
// The TypeScript compiler will fail to compile if the `data` argument to
// `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`.
// This type checking prevents the caller from specifying objects with
// incorrect properties or property values.
// @ts-expect-error "Argument of type { title: string; } is not assignable
// to parameter of type WithFieldValue<PostDbModel>"
await updateDoc(documentRef, { title: 'New Title' });
const snapshot2: DocumentSnapshot<Post> = await getDoc(documentRef);
const post2: Post = snapshot2.data()!;
if (post2) {
assertEqual(post2.title, 'My Life');
assertEqual(post2.author, 'NewFirstName Bar');
}
}
```
@@ -0,0 +1,90 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# FunctionExpression class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
This class defines the base class for Firestore functions, which can be evaluated within pipeline execution.
Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_.md#and_e72c712)<!-- -->, , or the methods on (<!-- -->, , etc.) to construct new Function instances.
<b>Signature:</b>
```typescript
export declare class FunctionExpression extends Expression
```
<b>Extends:</b> [Expression](./firestore_pipelines.expression.md#expression_class)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(name, params)](./firestore_pipelines.functionexpression.md#functionexpressionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>FunctionExpression</code> class |
| [(constructor)(name, params, \_methodName)](./firestore_pipelines.functionexpression.md#functionexpressionconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>FunctionExpression</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [expressionType](./firestore_pipelines.functionexpression.md#functionexpressionexpressiontype) | | [ExpressionType](./firestore_pipelines.md#expressiontype) | <b><i>(Public Preview)</i></b> |
## FunctionExpression.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `FunctionExpression` class
<b>Signature:</b>
```typescript
constructor(name: string, params: Expression[]);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | |
| params | [Expression](./firestore_pipelines.expression.md#expression_class)<!-- -->\[\] | |
## FunctionExpression.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `FunctionExpression` class
<b>Signature:</b>
```typescript
constructor(name: string, params: Expression[], _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | |
| params | [Expression](./firestore_pipelines.expression.md#expression_class)<!-- -->\[\] | |
| \_methodName | string \| undefined | |
## FunctionExpression.expressionType
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expressionType: ExpressionType;
```
@@ -0,0 +1,143 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# GeoPoint class
An immutable object representing a geographic location in Firestore. The location is represented as latitude/longitude pair.
Latitude values are in the range of \[-90, 90\]. Longitude values are in the range of \[-180, 180\].
<b>Signature:</b>
```typescript
export declare class GeoPoint
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(latitude, longitude)](./firestore_pipelines.geopoint.md#geopointconstructor) | | Creates a new immutable <code>GeoPoint</code> object with the provided latitude and longitude values. |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [latitude](./firestore_pipelines.geopoint.md#geopointlatitude) | | number | The latitude of this <code>GeoPoint</code> instance. |
| [longitude](./firestore_pipelines.geopoint.md#geopointlongitude) | | number | The longitude of this <code>GeoPoint</code> instance. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(json)](./firestore_pipelines.geopoint.md#geopointfromjson) | <code>static</code> | Builds a <code>GeoPoint</code> instance from a JSON object created by [GeoPoint.toJSON()](./firestore_.geopoint.md#geopointtojson)<!-- -->. |
| [isEqual(other)](./firestore_pipelines.geopoint.md#geopointisequal) | | Returns true if this <code>GeoPoint</code> is equal to the provided one. |
| [toJSON()](./firestore_pipelines.geopoint.md#geopointtojson) | | Returns a JSON-serializable representation of this <code>GeoPoint</code> instance. |
## GeoPoint.(constructor)
Creates a new immutable `GeoPoint` object with the provided latitude and longitude values.
<b>Signature:</b>
```typescript
constructor(latitude: number, longitude: number);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| latitude | number | The latitude as number between -90 and 90. |
| longitude | number | The longitude as number between -180 and 180. |
## GeoPoint.latitude
The latitude of this `GeoPoint` instance.
<b>Signature:</b>
```typescript
get latitude(): number;
```
## GeoPoint.longitude
The longitude of this `GeoPoint` instance.
<b>Signature:</b>
```typescript
get longitude(): number;
```
## GeoPoint.fromJSON()
Builds a `GeoPoint` instance from a JSON object created by [GeoPoint.toJSON()](./firestore_.geopoint.md#geopointtojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): GeoPoint;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | a JSON object represention of a <code>GeoPoint</code> instance |
<b>Returns:</b>
[GeoPoint](./firestore_.geopoint.md#geopoint_class)
an instance of [GeoPoint](./firestore_.geopoint.md#geopoint_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## GeoPoint.isEqual()
Returns true if this `GeoPoint` is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: GeoPoint): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [GeoPoint](./firestore_.geopoint.md#geopoint_class) | The <code>GeoPoint</code> to compare against. |
<b>Returns:</b>
boolean
true if this `GeoPoint` is equal to the provided one.
## GeoPoint.toJSON()
Returns a JSON-serializable representation of this `GeoPoint` instance.
<b>Signature:</b>
```typescript
toJSON(): {
latitude: number;
longitude: number;
type: string;
};
```
<b>Returns:</b>
{ latitude: number; longitude: number; type: string; }
a JSON representation of this object.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,80 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Ordering class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Represents an ordering criterion for sorting documents in a Firestore pipeline.
You create `Ordering` instances using the `ascending` and `descending` helper functions.
<b>Signature:</b>
```typescript
export declare class Ordering
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(expr, direction, \_methodName)](./firestore_pipelines.ordering.md#orderingconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>Ordering</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [direction](./firestore_pipelines.ordering.md#orderingdirection) | | 'ascending' \| 'descending' | <b><i>(Public Preview)</i></b> |
| [expr](./firestore_pipelines.ordering.md#orderingexpr) | | [Expression](./firestore_pipelines.expression.md#expression_class) | <b><i>(Public Preview)</i></b> |
## Ordering.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `Ordering` class
<b>Signature:</b>
```typescript
constructor(expr: Expression, direction: 'ascending' | 'descending', _methodName: string | undefined);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | |
| direction | 'ascending' \| 'descending' | |
| \_methodName | string \| undefined | |
## Ordering.direction
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly direction: 'ascending' | 'descending';
```
## Ordering.expr
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
readonly expr: Expression;
```
@@ -0,0 +1,674 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Pipeline class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
export declare class Pipeline
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [addFields(field, additionalFields)](./firestore_pipelines.pipeline.md#pipelineaddfields) | | <b><i>(Public Preview)</i></b> |
| [addFields(options)](./firestore_pipelines.pipeline.md#pipelineaddfields) | | <b><i>(Public Preview)</i></b> |
| [aggregate(accumulator, additionalAccumulators)](./firestore_pipelines.pipeline.md#pipelineaggregate) | | <b><i>(Public Preview)</i></b> |
| [aggregate(options)](./firestore_pipelines.pipeline.md#pipelineaggregate) | | <b><i>(Public Preview)</i></b> |
| [distinct(group, additionalGroups)](./firestore_pipelines.pipeline.md#pipelinedistinct) | | <b><i>(Public Preview)</i></b> |
| [distinct(options)](./firestore_pipelines.pipeline.md#pipelinedistinct) | | <b><i>(Public Preview)</i></b> |
| [findNearest(options)](./firestore_pipelines.pipeline.md#pipelinefindnearest) | | <b><i>(Public Preview)</i></b> |
| [limit(limit)](./firestore_pipelines.pipeline.md#pipelinelimit) | | <b><i>(Public Preview)</i></b> |
| [limit(options)](./firestore_pipelines.pipeline.md#pipelinelimit) | | <b><i>(Public Preview)</i></b> |
| [offset(offset)](./firestore_pipelines.pipeline.md#pipelineoffset) | | <b><i>(Public Preview)</i></b> |
| [offset(options)](./firestore_pipelines.pipeline.md#pipelineoffset) | | <b><i>(Public Preview)</i></b> |
| [rawStage(name, params, options)](./firestore_pipelines.pipeline.md#pipelinerawstage) | | <b><i>(Public Preview)</i></b> |
| [removeFields(fieldValue, additionalFields)](./firestore_pipelines.pipeline.md#pipelineremovefields) | | <b><i>(Public Preview)</i></b> |
| [removeFields(options)](./firestore_pipelines.pipeline.md#pipelineremovefields) | | <b><i>(Public Preview)</i></b> |
| [replaceWith(fieldName)](./firestore_pipelines.pipeline.md#pipelinereplacewith) | | <b><i>(Public Preview)</i></b> |
| [replaceWith(expr)](./firestore_pipelines.pipeline.md#pipelinereplacewith) | | <b><i>(Public Preview)</i></b> |
| [replaceWith(options)](./firestore_pipelines.pipeline.md#pipelinereplacewith) | | <b><i>(Public Preview)</i></b> |
| [sample(documents)](./firestore_pipelines.pipeline.md#pipelinesample) | | <b><i>(Public Preview)</i></b> |
| [sample(options)](./firestore_pipelines.pipeline.md#pipelinesample) | | <b><i>(Public Preview)</i></b> |
| [select(selection, additionalSelections)](./firestore_pipelines.pipeline.md#pipelineselect) | | <b><i>(Public Preview)</i></b> |
| [select(options)](./firestore_pipelines.pipeline.md#pipelineselect) | | <b><i>(Public Preview)</i></b> |
| [sort(ordering, additionalOrderings)](./firestore_pipelines.pipeline.md#pipelinesort) | | <b><i>(Public Preview)</i></b> |
| [sort(options)](./firestore_pipelines.pipeline.md#pipelinesort) | | <b><i>(Public Preview)</i></b> |
| [union(other)](./firestore_pipelines.pipeline.md#pipelineunion) | | <b><i>(Public Preview)</i></b> |
| [union(options)](./firestore_pipelines.pipeline.md#pipelineunion) | | <b><i>(Public Preview)</i></b> |
| [unnest(selectable, indexField)](./firestore_pipelines.pipeline.md#pipelineunnest) | | <b><i>(Public Preview)</i></b> |
| [unnest(options)](./firestore_pipelines.pipeline.md#pipelineunnest) | | <b><i>(Public Preview)</i></b> |
| [where(condition)](./firestore_pipelines.pipeline.md#pipelinewhere) | | <b><i>(Public Preview)</i></b> |
| [where(options)](./firestore_pipelines.pipeline.md#pipelinewhere) | | <b><i>(Public Preview)</i></b> |
## Pipeline.addFields()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
addFields(field: Selectable, ...additionalFields: Selectable[]): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| field | [Selectable](./firestore_pipelines.selectable.md#selectable_interface) | |
| additionalFields | [Selectable](./firestore_pipelines.selectable.md#selectable_interface)<!-- -->\[\] | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.addFields()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
addFields(options: AddFieldsStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [AddFieldsStageOptions](./firestore_pipelines.md#addfieldsstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.aggregate()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
aggregate(accumulator: AliasedAggregate, ...additionalAccumulators: AliasedAggregate[]): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| accumulator | [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) | |
| additionalAccumulators | [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class)<!-- -->\[\] | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.aggregate()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
aggregate(options: AggregateStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [AggregateStageOptions](./firestore_pipelines.md#aggregatestageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.distinct()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
distinct(group: string | Selectable, ...additionalGroups: Array<string | Selectable>): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| group | string \| [Selectable](./firestore_pipelines.selectable.md#selectable_interface) | |
| additionalGroups | Array&lt;string \| [Selectable](./firestore_pipelines.selectable.md#selectable_interface)<!-- -->&gt; | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.distinct()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
distinct(options: DistinctStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [DistinctStageOptions](./firestore_pipelines.md#distinctstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.findNearest()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
findNearest(options: FindNearestStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [FindNearestStageOptions](./firestore_pipelines.md#findneareststageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.limit()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
limit(limit: number): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| limit | number | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.limit()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
limit(options: LimitStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [LimitStageOptions](./firestore_pipelines.md#limitstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.offset()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
offset(offset: number): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| offset | number | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.offset()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
offset(options: OffsetStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [OffsetStageOptions](./firestore_pipelines.md#offsetstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.rawStage()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
rawStage(name: string, params: unknown[], options?: { [key: string]: Expression | unknown; }): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| name | string | |
| params | unknown\[\] | |
| options | { \[key: string\]: [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown; } | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.removeFields()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
removeFields(fieldValue: Field | string, ...additionalFields: Array<Field | string>): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldValue | [Field](./firestore_pipelines.field.md#field_class) \| string | |
| additionalFields | Array&lt;[Field](./firestore_pipelines.field.md#field_class) \| string&gt; | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.removeFields()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
removeFields(options: RemoveFieldsStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [RemoveFieldsStageOptions](./firestore_pipelines.md#removefieldsstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.replaceWith()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
replaceWith(fieldName: string): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldName | string | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.replaceWith()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
replaceWith(expr: Expression): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.replaceWith()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
replaceWith(options: ReplaceWithStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [ReplaceWithStageOptions](./firestore_pipelines.md#replacewithstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.sample()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
sample(documents: number): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| documents | number | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.sample()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
sample(options: SampleStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [SampleStageOptions](./firestore_pipelines.md#samplestageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.select()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
select(selection: Selectable | string, ...additionalSelections: Array<Selectable | string>): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| selection | [Selectable](./firestore_pipelines.selectable.md#selectable_interface) \| string | |
| additionalSelections | Array&lt;[Selectable](./firestore_pipelines.selectable.md#selectable_interface) \| string&gt; | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.select()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
select(options: SelectStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [SelectStageOptions](./firestore_pipelines.md#selectstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.sort()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
sort(ordering: Ordering, ...additionalOrderings: Ordering[]): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| ordering | [Ordering](./firestore_pipelines.ordering.md#ordering_class) | |
| additionalOrderings | [Ordering](./firestore_pipelines.ordering.md#ordering_class)<!-- -->\[\] | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.sort()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
sort(options: SortStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [SortStageOptions](./firestore_pipelines.md#sortstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.union()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
union(other: Pipeline): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.union()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
union(options: UnionStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [UnionStageOptions](./firestore_pipelines.md#unionstageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.unnest()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
unnest(selectable: Selectable, indexField?: string): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| selectable | [Selectable](./firestore_pipelines.selectable.md#selectable_interface) | |
| indexField | string | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.unnest()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
unnest(options: UnnestStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [UnnestStageOptions](./firestore_pipelines.md#unneststageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.where()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
where(condition: BooleanExpression): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| condition | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
## Pipeline.where()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
where(options: WhereStageOptions): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [WhereStageOptions](./firestore_pipelines.md#wherestageoptions) | |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
@@ -0,0 +1,132 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# PipelineExecuteOptions interface
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Options defining Pipeline execution.
<b>Signature:</b>
```typescript
export declare interface PipelineExecuteOptions
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [indexMode](./firestore_pipelines.pipelineexecuteoptions.md#pipelineexecuteoptionsindexmode) | 'recommended' | <b><i>(Public Preview)</i></b> Specify the index mode. |
| [pipeline](./firestore_pipelines.pipelineexecuteoptions.md#pipelineexecuteoptionspipeline) | [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) | <b><i>(Public Preview)</i></b> Pipeline to be evaluated. |
| [rawOptions](./firestore_pipelines.pipelineexecuteoptions.md#pipelineexecuteoptionsrawoptions) | { \[name: string\]: unknown; } | <b><i>(Public Preview)</i></b> An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.<!-- -->The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).<!-- -->Custom option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.<!-- -->Values specified in rawOptions will take precedence over any options with the same name set by the SDK.<!-- -->Override the <code>example_option</code>:
```
execute({
pipeline: myPipeline,
rawOptions: {
// Override `example_option`. This will not
// merge with the existing `example_option` object.
"example_option": {
foo: "bar"
}
}
}
```
<code>rawOptions</code> supports dot notation, if you want to override a nested option.
```
execute({
pipeline: myPipeline,
rawOptions: {
// Override `example_option.foo` and do not override
// any other properties of `example_option`.
"example_option.foo": "bar"
}
}
```
|
## PipelineExecuteOptions.indexMode
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Specify the index mode.
<b>Signature:</b>
```typescript
indexMode?: 'recommended';
```
## PipelineExecuteOptions.pipeline
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Pipeline to be evaluated.
<b>Signature:</b>
```typescript
pipeline: Pipeline;
```
## PipelineExecuteOptions.rawOptions
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.
The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).
Custom option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.
Values specified in rawOptions will take precedence over any options with the same name set by the SDK.
Override the `example_option`<!-- -->:
```
execute({
pipeline: myPipeline,
rawOptions: {
// Override `example_option`. This will not
// merge with the existing `example_option` object.
"example_option": {
foo: "bar"
}
}
}
```
`rawOptions` supports dot notation, if you want to override a nested option.
```
execute({
pipeline: myPipeline,
rawOptions: {
// Override `example_option.foo` and do not override
// any other properties of `example_option`.
"example_option.foo": "bar"
}
}
```
<b>Signature:</b>
```typescript
rawOptions?: {
[name: string]: unknown;
};
```
@@ -0,0 +1,168 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# PipelineResult class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the or methods.
<p>If the PipelineResult represents a non-document result, `ref` will return a undefined value.
<b>Signature:</b>
```typescript
export declare class PipelineResult<AppModelType = DocumentData>
```
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [createTime](./firestore_pipelines.pipelineresult.md#pipelineresultcreatetime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) \| undefined | <b><i>(Public Preview)</i></b> The time the document was created. Undefined if this result is not a document. {<!-- -->Timestamp\|undefined<!-- -->} |
| [id](./firestore_pipelines.pipelineresult.md#pipelineresultid) | | string \| undefined | <b><i>(Public Preview)</i></b> The ID of the document for which this PipelineResult contains data, if it is a document; otherwise <code>undefined</code>. {<!-- -->string<!-- -->} |
| [ref](./firestore_pipelines.pipelineresult.md#pipelineresultref) | | [DocumentReference](./firestore_.documentreference.md#documentreference_class) \| undefined | <b><i>(Public Preview)</i></b> The reference of the document, if it is a document; otherwise <code>undefined</code>. |
| [updateTime](./firestore_pipelines.pipelineresult.md#pipelineresultupdatetime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) \| undefined | <b><i>(Public Preview)</i></b> The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. {<!-- -->Timestamp\|undefined<!-- -->} |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [data()](./firestore_pipelines.pipelineresult.md#pipelineresultdata) | | <b><i>(Public Preview)</i></b> Retrieves all fields in the result as an object. |
| [get(fieldPath)](./firestore_pipelines.pipelineresult.md#pipelineresultget) | | <b><i>(Public Preview)</i></b> Retrieves the field specified by <code>field</code>. |
## PipelineResult.createTime
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The time the document was created. Undefined if this result is not a document.
{<!-- -->Timestamp\|undefined<!-- -->}
<b>Signature:</b>
```typescript
get createTime(): Timestamp | undefined;
```
## PipelineResult.id
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The ID of the document for which this PipelineResult contains data, if it is a document; otherwise `undefined`<!-- -->.
{<!-- -->string<!-- -->}
<b>Signature:</b>
```typescript
get id(): string | undefined;
```
## PipelineResult.ref
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The reference of the document, if it is a document; otherwise `undefined`<!-- -->.
<b>Signature:</b>
```typescript
get ref(): DocumentReference | undefined;
```
## PipelineResult.updateTime
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document.
{<!-- -->Timestamp\|undefined<!-- -->}
<b>Signature:</b>
```typescript
get updateTime(): Timestamp | undefined;
```
## PipelineResult.data()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Retrieves all fields in the result as an object.
<b>Signature:</b>
```typescript
data(): AppModelType;
```
<b>Returns:</b>
AppModelType
{<!-- -->T<!-- -->} An object containing all fields in the document or 'undefined' if the document doesn't exist.
### Example
```
let p = firestore.pipeline().collection('col');
p.execute().then(results => {
let data = results[0].data();
console.log(`Retrieved data: ${JSON.stringify(data)}`);
});
```
## PipelineResult.get()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Retrieves the field specified by `field`<!-- -->.
<b>Signature:</b>
```typescript
get(fieldPath: string | FieldPath | Field): any;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fieldPath | string \| [FieldPath](./firestore_.fieldpath.md#fieldpath_class) \| [Field](./firestore_pipelines.field.md#field_class) | |
<b>Returns:</b>
any
{<!-- -->\*<!-- -->} The data at the specified field location or undefined if no such field exists.
### Example
```
let p = firestore.pipeline().collection('col');
p.execute().then(results => {
let field = results[0].get('a.b');
console.log(`Retrieved field value: ${field}`);
});
```
@@ -0,0 +1,103 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# PipelineSnapshot class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Represents the results of a Firestore pipeline execution.
A `PipelineSnapshot` contains zero or more objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results.
<b>Signature:</b>
```typescript
export declare class PipelineSnapshot
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(pipeline, results, executionTime)](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshotconstructor) | | <b><i>(Public Preview)</i></b> Constructs a new instance of the <code>PipelineSnapshot</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [executionTime](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshotexecutiontime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) | <b><i>(Public Preview)</i></b> The time at which the pipeline producing this result is executed. {<!-- -->Timestamp<!-- -->} |
| [results](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshotresults) | | [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class)<!-- -->\[\] | <b><i>(Public Preview)</i></b> An array of all the results in the <code>PipelineSnapshot</code>. |
## PipelineSnapshot.(constructor)
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Constructs a new instance of the `PipelineSnapshot` class
<b>Signature:</b>
```typescript
constructor(pipeline: Pipeline, results: PipelineResult[], executionTime?: Timestamp);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| pipeline | [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) | |
| results | [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class)<!-- -->\[\] | |
| executionTime | [Timestamp](./firestore_.timestamp.md#timestamp_class) | |
## PipelineSnapshot.executionTime
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
The time at which the pipeline producing this result is executed.
{<!-- -->Timestamp<!-- -->}
<b>Signature:</b>
```typescript
get executionTime(): Timestamp;
```
## PipelineSnapshot.results
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An array of all the results in the `PipelineSnapshot`<!-- -->.
<b>Signature:</b>
```typescript
get results(): PipelineResult[];
```
### Example
```typescript
const snapshot: PipelineSnapshot = await firestore
.pipeline()
.collection('myCollection')
.where(field('value').greaterThan(10))
.execute();
snapshot.results.forEach(doc => {
console.log(doc.id, '=>', doc.data());
});
```
@@ -0,0 +1,251 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# PipelineSource class
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Provides the entry point for defining the data source of a Firestore .
Use the methods of this class (e.g., , , , or ) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents.
<b>Signature:</b>
```typescript
export declare class PipelineSource<PipelineType>
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [collection(collection)](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire collection. The collection can be nested. |
| [collection(options)](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire collection. The collection can be nested. |
| [collectionGroup(collectionId)](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) | | <b><i>(Public Preview)</i></b> Returns all documents from a collection ID regardless of the parent. |
| [collectionGroup(options)](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) | | <b><i>(Public Preview)</i></b> Returns all documents from a collection ID regardless of the parent. |
| [createFrom(query)](./firestore_pipelines.pipelinesource.md#pipelinesourcecreatefrom) | | <b><i>(Public Preview)</i></b> Convert the given Query into an equivalent Pipeline. |
| [database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire database. |
| [database(options)](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase) | | <b><i>(Public Preview)</i></b> Returns all documents from the entire database. |
| [documents(docs)](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments) | | <b><i>(Public Preview)</i></b> Set the pipeline's source to the documents specified by the given paths and DocumentReferences. |
| [documents(options)](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments) | | <b><i>(Public Preview)</i></b> Set the pipeline's source to the documents specified by the given paths and DocumentReferences. |
## PipelineSource.collection()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire collection. The collection can be nested.
<b>Signature:</b>
```typescript
collection(collection: string | Query): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| collection | string \| [Query](./firestore_.query.md#query_class) | Name or reference to the collection that will be used as the Pipeline source. |
<b>Returns:</b>
PipelineType
## PipelineSource.collection()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire collection. The collection can be nested.
<b>Signature:</b>
```typescript
collection(options: CollectionStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [CollectionStageOptions](./firestore_pipelines.md#collectionstageoptions) | Options defining how this CollectionStage is evaluated. |
<b>Returns:</b>
PipelineType
## PipelineSource.collectionGroup()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from a collection ID regardless of the parent.
<b>Signature:</b>
```typescript
collectionGroup(collectionId: string): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| collectionId | string | ID of the collection group to use as the Pipeline source. |
<b>Returns:</b>
PipelineType
## PipelineSource.collectionGroup()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from a collection ID regardless of the parent.
<b>Signature:</b>
```typescript
collectionGroup(options: CollectionGroupStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [CollectionGroupStageOptions](./firestore_pipelines.md#collectiongroupstageoptions) | Options defining how this CollectionGroupStage is evaluated. |
<b>Returns:</b>
PipelineType
## PipelineSource.createFrom()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Convert the given Query into an equivalent Pipeline.
<b>Signature:</b>
```typescript
createFrom(query: Query): Pipeline;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| query | [Query](./firestore_.query.md#query_class) | A Query to be converted into a Pipeline. |
<b>Returns:</b>
[Pipeline](./firestore_pipelines.pipeline.md#pipeline_class)
#### Exceptions
Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
## PipelineSource.database()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire database.
<b>Signature:</b>
```typescript
database(): PipelineType;
```
<b>Returns:</b>
PipelineType
## PipelineSource.database()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Returns all documents from the entire database.
<b>Signature:</b>
```typescript
database(options: DatabaseStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [DatabaseStageOptions](./firestore_pipelines.md#databasestageoptions) | Options defining how a DatabaseStage is evaluated. |
<b>Returns:</b>
PipelineType
## PipelineSource.documents()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Set the pipeline's source to the documents specified by the given paths and DocumentReferences.
<b>Signature:</b>
```typescript
documents(docs: Array<string | DocumentReference>): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| docs | Array&lt;string \| [DocumentReference](./firestore_.documentreference.md#documentreference_class)<!-- -->&gt; | An array of paths and DocumentReferences specifying the individual documents that will be the source of this pipeline. The converters for these DocumentReferences will be ignored and not have an effect on this pipeline. |
<b>Returns:</b>
PipelineType
#### Exceptions
Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
## PipelineSource.documents()
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Set the pipeline's source to the documents specified by the given paths and DocumentReferences.
<b>Signature:</b>
```typescript
documents(options: DocumentsStageOptions): PipelineType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [DocumentsStageOptions](./firestore_pipelines.md#documentsstageoptions) | Options defining how this DocumentsStage is evaluated. |
<b>Returns:</b>
PipelineType
#### Exceptions
Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.
+125
View File
@@ -0,0 +1,125 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Query class
A `Query` refers to a query which you can read or listen to. You can also construct refined `Query` objects by adding filters and ordering.
<b>Signature:</b>
```typescript
export declare class Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)()](./firestore_pipelines.query.md#queryconstructor) | | Constructs a new instance of the <code>Query</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [converter](./firestore_pipelines.query.md#queryconverter) | | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;AppModelType, DbModelType&gt; \| null | If provided, the <code>FirestoreDataConverter</code> associated with this instance. |
| [firestore](./firestore_pipelines.query.md#queryfirestore) | | [Firestore](./firestore_.firestore.md#firestore_class) | The <code>Firestore</code> instance for the Firestore database (useful for performing transactions, etc.). |
| [type](./firestore_pipelines.query.md#querytype) | | 'query' \| 'collection' | The type of this Firestore reference. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [withConverter(converter)](./firestore_pipelines.query.md#querywithconverter) | | Removes the current converter. |
| [withConverter(converter)](./firestore_pipelines.query.md#querywithconverter) | | Applies a custom data converter to this query, allowing you to use your own custom model objects with Firestore. When you call [getDocs()](./firestore_.md#getdocs_4e56953) with the returned query, the provided converter will convert between Firestore data of type <code>NewDbModelType</code> and your custom type <code>NewAppModelType</code>. |
## Query.(constructor)
Constructs a new instance of the `Query` class
<b>Signature:</b>
```typescript
protected constructor();
```
## Query.converter
If provided, the `FirestoreDataConverter` associated with this instance.
<b>Signature:</b>
```typescript
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
```
## Query.firestore
The `Firestore` instance for the Firestore database (useful for performing transactions, etc.).
<b>Signature:</b>
```typescript
readonly firestore: Firestore;
```
## Query.type
The type of this Firestore reference.
<b>Signature:</b>
```typescript
readonly type: 'query' | 'collection';
```
## Query.withConverter()
Removes the current converter.
<b>Signature:</b>
```typescript
withConverter(converter: null): Query<DocumentData, DocumentData>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | null | <code>null</code> removes the current converter. |
<b>Returns:</b>
[Query](./firestore_.query.md#query_class)<!-- -->&lt;[DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->, [DocumentData](./firestore_.documentdata.md#documentdata_interface)<!-- -->&gt;
A `Query<DocumentData, DocumentData>` that does not use a converter.
## Query.withConverter()
Applies a custom data converter to this query, allowing you to use your own custom model objects with Firestore. When you call [getDocs()](./firestore_.md#getdocs_4e56953) with the returned query, the provided converter will convert between Firestore data of type `NewDbModelType` and your custom type `NewAppModelType`<!-- -->.
<b>Signature:</b>
```typescript
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): Query<NewAppModelType, NewDbModelType>;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;NewAppModelType, NewDbModelType&gt; | Converts objects to and from Firestore. |
<b>Returns:</b>
[Query](./firestore_.query.md#query_class)<!-- -->&lt;NewAppModelType, NewDbModelType&gt;
A `Query` that uses the provided converter.
@@ -0,0 +1,54 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# QueryDocumentSnapshot class
A `QueryDocumentSnapshot` contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with `.data()` or `.get(<field>)` to get a specific field.
A `QueryDocumentSnapshot` offers the same API surface as a `DocumentSnapshot`<!-- -->. Since query results contain only existing documents, the `exists` property will always be true and `data()` will never return 'undefined'.
<b>Signature:</b>
```typescript
export declare class QueryDocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot<AppModelType, DbModelType>
```
<b>Extends:</b> [DocumentSnapshot](./firestore_.documentsnapshot.md#documentsnapshot_class)<!-- -->&lt;AppModelType, DbModelType&gt;
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [data(options)](./firestore_pipelines.querydocumentsnapshot.md#querydocumentsnapshotdata) | | Retrieves all fields in the document as an <code>Object</code>.<!-- -->By default, <code>serverTimestamp()</code> values that have not yet been set to their final value will be returned as <code>null</code>. You can override this by passing an options object. |
## QueryDocumentSnapshot.data()
Retrieves all fields in the document as an `Object`<!-- -->.
By default, `serverTimestamp()` values that have not yet been set to their final value will be returned as `null`<!-- -->. You can override this by passing an options object.
<b>Signature:</b>
```typescript
/** @override */
data(options?: SnapshotOptions): AppModelType;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [SnapshotOptions](./firestore_.snapshotoptions.md#snapshotoptions_interface) | An options object to configure how data is retrieved from the snapshot (for example the desired behavior for server timestamps that have not yet been set to their final value). |
<b>Returns:</b>
AppModelType
An `Object` containing all fields in the document.
@@ -0,0 +1,39 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Selectable interface
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An interface that represents a selectable expression.
<b>Signature:</b>
```typescript
export declare interface Selectable
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [selectable](./firestore_pipelines.selectable.md#selectableselectable) | true | <b><i>(Public Preview)</i></b> |
## Selectable.selectable
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
<b>Signature:</b>
```typescript
selectable: true;
```
@@ -0,0 +1,75 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# SnapshotMetadata class
Metadata about a snapshot, describing the state of the snapshot.
<b>Signature:</b>
```typescript
export declare class SnapshotMetadata
```
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [fromCache](./firestore_pipelines.snapshotmetadata.md#snapshotmetadatafromcache) | | boolean | True if the snapshot was created from cached data rather than guaranteed up-to-date server data. If your listener has opted into metadata updates (via <code>SnapshotListenOptions</code>) you will receive another snapshot with <code>fromCache</code> set to false once the client has received up-to-date data from the backend. |
| [hasPendingWrites](./firestore_pipelines.snapshotmetadata.md#snapshotmetadatahaspendingwrites) | | boolean | True if the snapshot contains the result of local writes (for example <code>set()</code> or <code>update()</code> calls) that have not yet been committed to the backend. If your listener has opted into metadata updates (via <code>SnapshotListenOptions</code>) you will receive another snapshot with <code>hasPendingWrites</code> equal to false once the writes have been committed to the backend. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [isEqual(other)](./firestore_pipelines.snapshotmetadata.md#snapshotmetadataisequal) | | Returns true if this <code>SnapshotMetadata</code> is equal to the provided one. |
## SnapshotMetadata.fromCache
True if the snapshot was created from cached data rather than guaranteed up-to-date server data. If your listener has opted into metadata updates (via `SnapshotListenOptions`<!-- -->) you will receive another snapshot with `fromCache` set to false once the client has received up-to-date data from the backend.
<b>Signature:</b>
```typescript
readonly fromCache: boolean;
```
## SnapshotMetadata.hasPendingWrites
True if the snapshot contains the result of local writes (for example `set()` or `update()` calls) that have not yet been committed to the backend. If your listener has opted into metadata updates (via `SnapshotListenOptions`<!-- -->) you will receive another snapshot with `hasPendingWrites` equal to false once the writes have been committed to the backend.
<b>Signature:</b>
```typescript
readonly hasPendingWrites: boolean;
```
## SnapshotMetadata.isEqual()
Returns true if this `SnapshotMetadata` is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: SnapshotMetadata): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [SnapshotMetadata](./firestore_.snapshotmetadata.md#snapshotmetadata_class) | The <code>SnapshotMetadata</code> to compare against. |
<b>Returns:</b>
boolean
true if this `SnapshotMetadata` is equal to the provided one.
@@ -0,0 +1,41 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# SnapshotOptions interface
Options that configure how data is retrieved from a `DocumentSnapshot` (for example the desired behavior for server timestamps that have not yet been set to their final value).
<b>Signature:</b>
```typescript
export declare interface SnapshotOptions
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [serverTimestamps](./firestore_pipelines.snapshotoptions.md#snapshotoptionsservertimestamps) | 'estimate' \| 'previous' \| 'none' | If set, controls the return value for server timestamps that have not yet been set to their final value.<!-- -->By specifying 'estimate', pending server timestamps return an estimate based on the local clock. This estimate will differ from the final value and cause these values to change once the server result becomes available.<!-- -->By specifying 'previous', pending timestamps will be ignored and return their previous value instead.<!-- -->If omitted or set to 'none', <code>null</code> will be returned by default until the server value becomes available. |
## SnapshotOptions.serverTimestamps
If set, controls the return value for server timestamps that have not yet been set to their final value.
By specifying 'estimate', pending server timestamps return an estimate based on the local clock. This estimate will differ from the final value and cause these values to change once the server result becomes available.
By specifying 'previous', pending timestamps will be ignored and return their previous value instead.
If omitted or set to 'none', `null` will be returned by default until the server value becomes available.
<b>Signature:</b>
```typescript
readonly serverTimestamps?: 'estimate' | 'previous' | 'none';
```
@@ -0,0 +1,51 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# StageOptions interface
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
Options defining how a Stage is evaluated.
<b>Signature:</b>
```typescript
export declare interface StageOptions
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [rawOptions](./firestore_pipelines.stageoptions.md#stageoptionsrawoptions) | { \[name: string\]: unknown; } | <b><i>(Public Preview)</i></b> An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.<!-- -->The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).<!-- -->Raw option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.<!-- -->Values specified in rawOptions will take precedence over any options with the same name set by the SDK.<code>rawOptions</code> supports dot notation, if you want to override a nested option. |
## StageOptions.rawOptions
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
>
An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.
The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).
Raw option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.
Values specified in rawOptions will take precedence over any options with the same name set by the SDK.
`rawOptions` supports dot notation, if you want to override a nested option.
<b>Signature:</b>
```typescript
rawOptions?: {
[name: string]: unknown;
};
```
@@ -0,0 +1,265 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# Timestamp class
A `Timestamp` represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.
It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
For examples and further specifications, refer to the [Timestamp definition](https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto)<!-- -->.
<b>Signature:</b>
```typescript
export declare class Timestamp
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(seconds, nanoseconds)](./firestore_pipelines.timestamp.md#timestampconstructor) | | Creates a new timestamp. |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [nanoseconds](./firestore_pipelines.timestamp.md#timestampnanoseconds) | | number | The fractions of a second at nanosecond resolution.\* |
| [seconds](./firestore_pipelines.timestamp.md#timestampseconds) | | number | The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromDate(date)](./firestore_pipelines.timestamp.md#timestampfromdate) | <code>static</code> | Creates a new timestamp from the given date. |
| [fromJSON(json)](./firestore_pipelines.timestamp.md#timestampfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->. |
| [fromMillis(milliseconds)](./firestore_pipelines.timestamp.md#timestampfrommillis) | <code>static</code> | Creates a new timestamp from the given number of milliseconds. |
| [isEqual(other)](./firestore_pipelines.timestamp.md#timestampisequal) | | Returns true if this <code>Timestamp</code> is equal to the provided one. |
| [now()](./firestore_pipelines.timestamp.md#timestampnow) | <code>static</code> | Creates a new timestamp with the current date, with millisecond precision. |
| [toDate()](./firestore_pipelines.timestamp.md#timestamptodate) | | Converts a <code>Timestamp</code> to a JavaScript <code>Date</code> object. This conversion causes a loss of precision since <code>Date</code> objects only support millisecond precision. |
| [toJSON()](./firestore_pipelines.timestamp.md#timestamptojson) | | Returns a JSON-serializable representation of this <code>Timestamp</code>. |
| [toMillis()](./firestore_pipelines.timestamp.md#timestamptomillis) | | Converts a <code>Timestamp</code> to a numeric timestamp (in milliseconds since epoch). This operation causes a loss of precision. |
| [toString()](./firestore_pipelines.timestamp.md#timestamptostring) | | Returns a textual representation of this <code>Timestamp</code>. |
| [valueOf()](./firestore_pipelines.timestamp.md#timestampvalueof) | | Converts this object to a primitive string, which allows <code>Timestamp</code> objects to be compared using the <code>&gt;</code>, <code>&lt;=</code>, <code>&gt;=</code> and <code>&gt;</code> operators. |
## Timestamp.(constructor)
Creates a new timestamp.
<b>Signature:</b>
```typescript
constructor(
seconds: number,
nanoseconds: number);
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| seconds | number | The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. |
| nanoseconds | number | The non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanoseconds values that count forward in time. Must be from 0 to 999,999,999 inclusive. |
## Timestamp.nanoseconds
The fractions of a second at nanosecond resolution.\*
<b>Signature:</b>
```typescript
readonly nanoseconds: number;
```
## Timestamp.seconds
The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
<b>Signature:</b>
```typescript
readonly seconds: number;
```
## Timestamp.fromDate()
Creates a new timestamp from the given date.
<b>Signature:</b>
```typescript
static fromDate(date: Date): Timestamp;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| date | Date | The date to initialize the <code>Timestamp</code> from. |
<b>Returns:</b>
[Timestamp](./firestore_.timestamp.md#timestamp_class)
A new `Timestamp` representing the same point in time as the given date.
## Timestamp.fromJSON()
Builds a `Timestamp` instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): Timestamp;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | |
<b>Returns:</b>
[Timestamp](./firestore_.timestamp.md#timestamp_class)
## Timestamp.fromMillis()
Creates a new timestamp from the given number of milliseconds.
<b>Signature:</b>
```typescript
static fromMillis(milliseconds: number): Timestamp;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| milliseconds | number | Number of milliseconds since Unix epoch 1970-01-01T00:00:00Z. |
<b>Returns:</b>
[Timestamp](./firestore_.timestamp.md#timestamp_class)
A new `Timestamp` representing the same point in time as the given number of milliseconds.
## Timestamp.isEqual()
Returns true if this `Timestamp` is equal to the provided one.
<b>Signature:</b>
```typescript
isEqual(other: Timestamp): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [Timestamp](./firestore_.timestamp.md#timestamp_class) | The <code>Timestamp</code> to compare against. |
<b>Returns:</b>
boolean
true if this `Timestamp` is equal to the provided one.
## Timestamp.now()
Creates a new timestamp with the current date, with millisecond precision.
<b>Signature:</b>
```typescript
static now(): Timestamp;
```
<b>Returns:</b>
[Timestamp](./firestore_.timestamp.md#timestamp_class)
a new timestamp representing the current date.
## Timestamp.toDate()
Converts a `Timestamp` to a JavaScript `Date` object. This conversion causes a loss of precision since `Date` objects only support millisecond precision.
<b>Signature:</b>
```typescript
toDate(): Date;
```
<b>Returns:</b>
Date
JavaScript `Date` object representing the same point in time as this `Timestamp`<!-- -->, with millisecond precision.
## Timestamp.toJSON()
Returns a JSON-serializable representation of this `Timestamp`<!-- -->.
<b>Signature:</b>
```typescript
toJSON(): {
seconds: number;
nanoseconds: number;
type: string;
};
```
<b>Returns:</b>
{ seconds: number; nanoseconds: number; type: string; }
## Timestamp.toMillis()
Converts a `Timestamp` to a numeric timestamp (in milliseconds since epoch). This operation causes a loss of precision.
<b>Signature:</b>
```typescript
toMillis(): number;
```
<b>Returns:</b>
number
The point in time corresponding to this timestamp, represented as the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
## Timestamp.toString()
Returns a textual representation of this `Timestamp`<!-- -->.
<b>Signature:</b>
```typescript
toString(): string;
```
<b>Returns:</b>
string
## Timestamp.valueOf()
Converts this object to a primitive string, which allows `Timestamp` objects to be compared using the `>`<!-- -->, `<=`<!-- -->, `>=` and `>` operators.
<b>Signature:</b>
```typescript
valueOf(): string;
```
<b>Returns:</b>
string
@@ -0,0 +1,101 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference
{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
# VectorValue class
Represents a vector type in Firestore documents. Create an instance with <code>[vector()](./firestore_.md#vector_0dbdaf2)</code>.
VectorValue
<b>Signature:</b>
```typescript
export declare class VectorValue
```
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [fromJSON(json)](./firestore_pipelines.vectorvalue.md#vectorvaluefromjson) | <code>static</code> | Builds a <code>VectorValue</code> instance from a JSON object created by [VectorValue.toJSON()](./firestore_.vectorvalue.md#vectorvaluetojson)<!-- -->. |
| [isEqual(other)](./firestore_pipelines.vectorvalue.md#vectorvalueisequal) | | Returns <code>true</code> if the two <code>VectorValue</code> values have the same raw number arrays, returns <code>false</code> otherwise. |
| [toArray()](./firestore_pipelines.vectorvalue.md#vectorvaluetoarray) | | Returns a copy of the raw number array form of the vector. |
| [toJSON()](./firestore_pipelines.vectorvalue.md#vectorvaluetojson) | | Returns a JSON-serializable representation of this <code>VectorValue</code> instance. |
## VectorValue.fromJSON()
Builds a `VectorValue` instance from a JSON object created by [VectorValue.toJSON()](./firestore_.vectorvalue.md#vectorvaluetojson)<!-- -->.
<b>Signature:</b>
```typescript
static fromJSON(json: object): VectorValue;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| json | object | a JSON object represention of a <code>VectorValue</code> instance. |
<b>Returns:</b>
[VectorValue](./firestore_.vectorvalue.md#vectorvalue_class)
an instance of [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
## VectorValue.isEqual()
Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
<b>Signature:</b>
```typescript
isEqual(other: VectorValue): boolean;
```
#### Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| other | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | |
<b>Returns:</b>
boolean
## VectorValue.toArray()
Returns a copy of the raw number array form of the vector.
<b>Signature:</b>
```typescript
toArray(): number[];
```
<b>Returns:</b>
number\[\]
## VectorValue.toJSON()
Returns a JSON-serializable representation of this `VectorValue` instance.
<b>Signature:</b>
```typescript
toJSON(): object;
```
<b>Returns:</b>
object
a JSON representation of this object.
+12 -1
View File
@@ -48,7 +48,8 @@ function copyTests() {
testBase + '/integration/util/settings.ts',
testBase + '/integration/util/testing_hooks_util.ts',
testBase + '/util/equality_matcher.ts',
testBase + '/util/promise.ts'
testBase + '/util/promise.ts',
testBase + '/util/mocha_extensions.ts'
],
{ base: '../../packages/firestore' }
)
@@ -69,6 +70,16 @@ if (typeof process === 'undefined') {
`
)
)
.pipe(
replace(
/**
* This regex is designed to match the Firebase import in our
* integration tests.
*/
/\s+from '\.(\.\/util)?\/pipeline_export';/,
` from '${resolve(__dirname, './pipeline_export')}';`
)
)
.pipe(
/**
* Fixing the project.json require to properly reference the file
+4 -3
View File
@@ -3,9 +3,10 @@
"version": "1.0.1",
"private": true,
"scripts": {
"build:deps": "lerna run --scope @firebase/'{app,firestore}' --include-dependencies build",
"build:persistence": "INCLUDE_FIRESTORE_PERSISTENCE=true gulp compile-tests",
"build:memory": "INCLUDE_FIRESTORE_PERSISTENCE=false gulp compile-tests",
"build:deps": "lerna run --scope @firebase/'{app,firestore}' --include-dependencies build && npm run typings:public",
"typings:public": "lerna run --scope @firebase/'{app,firestore}' --include-dependencies typings:public",
"build:persistence": "yarn typings:public && INCLUDE_FIRESTORE_PERSISTENCE=true gulp compile-tests",
"build:memory": "yarn typings:public && INCLUDE_FIRESTORE_PERSISTENCE=false gulp compile-tests",
"karma:singlerun": "karma start",
"prettier": "prettier --write '*.js' '*.ts'",
"test:persistence": " yarn build:persistence; karma start",
+21
View File
@@ -0,0 +1,21 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This file replaces "packages/firestore/test/integration/util/pipeline_export"
// and depends on the minified sources.
export * from '@firebase/firestore/pipelines';
+1
View File
@@ -142,6 +142,7 @@
"postinstall-postinstall": "2.1.0",
"prettier": "2.8.8",
"protractor": "5.4.2",
"protobufjs-cli": "^1.1.3",
"request": "2.88.2",
"semver": "7.7.1",
"simple-git": "3.27.0",
@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from '@firebase/firestore/lite/pipelines';
@@ -0,0 +1,7 @@
{
"name": "firebase/firestore/lite/pipelines",
"main": "dist/pipelines.cjs.js",
"browser": "dist/esm/pipelines.esm.js",
"module": "dist/esm/pipelines.esm.js",
"typings": "dist/firestore/lite/pipelines/index.d.ts"
}
+1 -1
View File
@@ -4,4 +4,4 @@
"browser": "dist/esm/index.esm.js",
"module": "dist/esm/index.esm.js",
"typings": "dist/firestore/index.d.ts"
}
}
@@ -0,0 +1,21 @@
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from '@firebase/firestore';
import * as pipelines from '@firebase/firestore/pipelines';
export { pipelines };
@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from '@firebase/firestore/pipelines';
@@ -0,0 +1,7 @@
{
"name": "firebase/firestore/pipelines",
"main": "dist/pipelines.cjs.js",
"browser": "dist/esm/pipelines.esm.js",
"module": "dist/esm/pipelines.esm.js",
"typings": "dist/firestore/pipelines/index.d.ts"
}
+1 -1
View File
@@ -21,7 +21,7 @@ const replace = require('gulp-replace');
const pkgJson = require('./package.json');
const files = pkgJson.components.map(component => {
const componentName = component.replace('/', '-');
const componentName = component.replaceAll('/', '-');
return `firebase-${componentName}.js`;
});
const FIREBASE_APP_URL = `https://www.gstatic.com/firebasejs/${pkgJson.version}/firebase-app.js`;
+26
View File
@@ -131,6 +131,18 @@
},
"default": "./firestore/dist/esm/index.esm.js"
},
"./firestore/pipelines": {
"types": "./firestore/pipelines/dist/firestore/pipelines/index.d.ts",
"node": {
"require": "./firestore/pipelines/dist/pipelines.cjs.js",
"import": "./firestore/pipelines/dist/pipelines.mjs"
},
"browser": {
"require": "./firestore/pipelines/dist/pipelines.cjs.js",
"import": "./firestore/pipelines/dist/esm/pipelines.esm.js"
},
"default": "./firestore/pipelines/dist/esm/pipelines.esm.js"
},
"./firestore/lite": {
"types": "./firestore/lite/dist/firestore/lite/index.d.ts",
"node": {
@@ -143,6 +155,18 @@
},
"default": "./firestore/lite/dist/esm/index.esm.js"
},
"./firestore/lite/pipelines": {
"types": "./firestore/lite/pipelines/dist/firestore/lite/pipelines/index.d.ts",
"node": {
"require": "./firestore/lite/pipelines/dist/pipelines.cjs.js",
"import": "./firestore/lite/pipelines/dist/pipelines.mjs"
},
"browser": {
"require": "./firestore/lite/pipelines/dist/pipelines.cjs.js",
"import": "./firestore/lite/pipelines/dist/esm/pipelines.esm.js"
},
"default": "./firestore/lite/pipelines/dist/esm/pipelines.esm.js"
},
"./functions": {
"types": "./functions/dist/functions/index.d.ts",
"node": {
@@ -453,6 +477,8 @@
"functions",
"firestore",
"firestore/lite",
"firestore/pipelines",
"firestore/lite/pipelines",
"installations",
"storage",
"performance",
+5 -2
View File
@@ -20,6 +20,7 @@ import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import pkg from './package.json';
import { resolve } from 'path';
import { existsSync } from 'fs';
import resolveModule from '@rollup/plugin-node-resolve';
import rollupTypescriptPlugin from 'rollup-plugin-typescript2';
import sourcemaps from 'rollup-plugin-sourcemaps';
@@ -149,10 +150,12 @@ const cdnBuilds = [
.map(component => {
// It is needed for handling sub modules, for example firestore/lite which should produce firebase-firestore-lite.js
// Otherwise, we will create a directory with '/' in the name.
const componentName = component.replace('/', '-');
const componentName = component.replaceAll('/', '-');
return {
input: `${component}/index.ts`,
input: existsSync(`${component}/index.cdn.ts`)
? `${component}/index.cdn.ts`
: `${component}/index.ts`,
output: {
file: `firebase-${componentName}.js`,
sourcemap: true,
+1 -1
View File
@@ -24,7 +24,7 @@ module.exports = {
tsconfigRootDir: __dirname
},
plugins: ['import'],
ignorePatterns: ['compat/*'],
ignorePatterns: ['compat/*', 'pipelines.d.ts'],
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
'@typescript-eslint/no-unused-vars': [
+14 -6
View File
@@ -4,13 +4,21 @@
* apiReport and d.ts rollup are handled by scripts/api-report.ts.
*/
"extends": "../../config/api-extractor.json",
// Point it to your entry point d.ts file.
// Point it to your entry point d.ts file.
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
"additionalEntryPoints": [
{
"modulePath": "lite",
"filePath": "<projectFolder>/dist/lite/index.d.ts"
}
{
"modulePath": "lite",
"filePath": "<projectFolder>/dist/lite/index.d.ts"
},
{
"modulePath": "pipelines",
"filePath": "<projectFolder>/dist/pipelines.d.ts"
},
{
"modulePath": "lite/pipelines",
"filePath": "<projectFolder>/dist/lite/pipelines.d.ts"
}
],
"apiReport": {
/**
@@ -18,4 +26,4 @@
*/
"enabled": false
}
}
}
+2
View File
@@ -17,7 +17,9 @@
"packages/app-check-interop-types/index.d.ts",
"packages/auth-interop-types/index.d.ts",
"packages/firestore/dist/lite/internal.d.ts",
"packages/firestore/dist/lite/internal.pipelines.d.ts",
"packages/firestore/dist/internal.d.ts",
"packages/firestore/dist/internal.pipelines.d.ts",
"packages/firestore-types/index.d.ts",
"packages/firebase/compat/index.d.ts",
"packages/component/dist/src/component.d.ts",
@@ -0,0 +1,14 @@
{
"name": "@firebase/firestore-lite-pipelines",
"description": "Pipelines for the lite Firestore SDK",
"main": "../../dist/lite/pipelines.node.cjs.js",
"main-esm": "../../dist/lite/pipelines.node.mjs",
"module": "../../dist/lite/pipelines.browser.esm.js",
"browser": "../../dist/lite/pipelines.browser.esm.js",
"react-native": "../../dist/lite/pipelines.rn.esm.js",
"typings": "./pipelines.d.ts",
"private": true,
"engines": {
"node": ">=20.0.0"
}
}
+28
View File
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PipelineSource, Pipeline } from '../../dist/lite/pipelines';
// Augument the Firestore class with the pipeline() method.
// This is stripped from dist/lite/pipelines.d.ts during the build
// so it needs to be re-added here.
declare module '@firebase/firestore/lite' {
interface Firestore {
pipeline(): PipelineSource<Pipeline>;
}
}
export * from '../../dist/lite/pipelines';
@@ -0,0 +1,194 @@
/**
* Firestore Lite Pipelines
*
* @remarks Firestore Lite is a small online-only SDK that allows read
* and write access to your Firestore database. All operations connect
* directly to the backend, and `onSnapshot()` APIs are not supported.
* @packageDocumentation
*/
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// External exports: ./index
// These external exports will be stripped from the dist/pipelines.d.ts file
// by the prune-dts script, in order to reduce type duplication. However, these
// types need to be exported here to ensure that api-extractor behaves
// correctly. If a type from api.ts is missing from this export, then
// api-extractor may rename it with a suffix `_#`, e.g. `YourType_2`.
export type {
Timestamp,
DocumentReference,
VectorValue,
GeoPoint,
FieldPath,
DocumentData,
Query,
Firestore,
FirestoreDataConverter,
WithFieldValue,
PartialWithFieldValue,
SetOptions,
QueryDocumentSnapshot,
Primitive,
FieldValue,
Bytes
} from '../index';
export { PipelineSource } from '../../src/lite-api/pipeline-source';
export { OneOf } from '../../src/util/types';
export {
PipelineResult,
PipelineSnapshot
} from '../../src/lite-api/pipeline-result';
export { Pipeline } from '../../src/lite-api/pipeline';
export { execute } from '../../src/lite-api/pipeline_impl';
export {
StageOptions,
CollectionStageOptions,
CollectionGroupStageOptions,
DatabaseStageOptions,
DocumentsStageOptions,
AddFieldsStageOptions,
RemoveFieldsStageOptions,
SelectStageOptions,
WhereStageOptions,
OffsetStageOptions,
LimitStageOptions,
DistinctStageOptions,
AggregateStageOptions,
FindNearestStageOptions,
ReplaceWithStageOptions,
SampleStageOptions,
UnionStageOptions,
UnnestStageOptions,
SortStageOptions
} from '../../src/lite-api/stage_options';
export {
Expression,
field,
and,
array,
constant,
add,
subtract,
multiply,
average,
substring,
count,
mapMerge,
mapRemove,
ifError,
isAbsent,
isError,
or,
divide,
map,
mod,
documentId,
equal,
notEqual,
lessThan,
countIf,
lessThanOrEqual,
greaterThan,
greaterThanOrEqual,
arrayConcat,
arrayContains,
arrayContainsAny,
arrayContainsAll,
arrayLength,
equalAny,
notEqualAny,
xor,
conditional,
not,
logicalMaximum,
logicalMinimum,
exists,
reverse,
byteLength,
charLength,
like,
regexContains,
regexMatch,
stringContains,
startsWith,
endsWith,
toLower,
toUpper,
trim,
stringConcat,
mapGet,
countAll,
minimum,
maximum,
cosineDistance,
dotProduct,
euclideanDistance,
vectorLength,
unixMicrosToTimestamp,
timestampToUnixMicros,
unixMillisToTimestamp,
timestampToUnixMillis,
unixSecondsToTimestamp,
timestampToUnixSeconds,
timestampAdd,
timestampSubtract,
ascending,
descending,
arrayGet,
abs,
sum,
countDistinct,
ceil,
floor,
exp,
pow,
round,
collectionId,
ln,
log,
sqrt,
stringReverse,
log10,
concat,
currentTimestamp,
ifAbsent,
join,
length,
arraySum,
split,
timestampTruncate,
type,
AliasedExpression,
Field,
Constant,
FunctionExpression,
Ordering,
ExpressionType,
AliasedAggregate,
Selectable,
BooleanExpression,
AggregateFunction,
TimeGranularity
} from '../../src/lite-api/expressions';
+36 -3
View File
@@ -8,6 +8,7 @@
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
"scripts": {
"bundle": "rollup -c",
"compile": "tsc --emitDeclarationOnly --declaration -p tsconfig.json",
"prebuild": "tsc --emitDeclarationOnly --declaration -p tsconfig.json; yarn api-report",
"build": "run-p --npm-path npm build:lite build:main",
"build:release": "yarn build && yarn typings:public",
@@ -50,9 +51,11 @@
"test:minified": "(cd ../../integration/firestore ; yarn test)",
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
"api-report:main": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore --packageRoot . --typescriptDts ./dist/firestore/src/index.d.ts --rollupDts ./dist/private.d.ts --untrimmedRollupDts ./dist/internal.d.ts --publicDts ./dist/index.d.ts",
"api-report:pipelines": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore-pipelines --packageRoot . --typescriptDts ./dist/firestore/pipelines/pipelines.d.ts --rollupDts ./dist/private.pipelines.d.ts --untrimmedRollupDts ./dist/internal.pipelines.d.ts --publicDts ./dist/pipelines.d.ts --otherExportsPublicDtsFiles ./dist/index.d.ts",
"api-report:lite": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore-lite --packageRoot . --typescriptDts ./dist/firestore/lite/index.d.ts --rollupDts ./dist/lite/private.d.ts --untrimmedRollupDts ./dist/lite/internal.d.ts --publicDts ./dist/lite/index.d.ts",
"api-report:lite:pipelines": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore-lite-pipelines --packageRoot . --typescriptDts ./dist/firestore/lite/pipelines/pipelines.d.ts --rollupDts ./dist/lite/private.pipelines.d.ts --untrimmedRollupDts ./dist/lite/internal.pipelines.d.ts --publicDts ./dist/lite/pipelines.d.ts --otherExportsPublicDtsFiles ./dist/lite/index.d.ts",
"api-report:api-json": "rm -rf temp && api-extractor run --local --verbose",
"api-report": "run-s --npm-path npm api-report:main api-report:lite && yarn api-report:api-json",
"api-report": "run-s --npm-path npm api-report:main api-report:pipelines api-report:lite api-report:lite:pipelines && yarn api-report:api-json",
"doc": "api-documenter markdown --input temp --output docs",
"typings:public": "node ../../scripts/build/use_typings.js ./dist/index.d.ts",
"assertion-id:check": "ts-node scripts/assertion-id-tool.ts --dir=src --check",
@@ -82,11 +85,37 @@
},
"react-native": "./dist/lite/index.rn.esm.js",
"browser": {
"require": "./dist/lite/index.cjs.js",
"require": "./dist/lite/index.browser.cjs.js",
"import": "./dist/lite/index.browser.esm.js"
},
"default": "./dist/lite/index.browser.esm.js"
},
"./lite/pipelines": {
"types": "./dist/lite/pipelines.d.ts",
"node": {
"require": "./dist/lite/pipelines.node.cjs.js",
"import": "./dist/lite/pipelines.node.mjs"
},
"react-native": "./dist/lite/pipelines.rn.esm.js",
"browser": {
"require": "./dist/lite/pipelines.browser.cjs.js",
"import": "./dist/lite/pipelines.browser.esm.js"
},
"default": "./dist/lite/pipelines.browser.esm.js"
},
"./pipelines": {
"types": "./pipelines/pipelines.d.ts",
"node": {
"require": "./dist/pipelines.node.cjs.js",
"import": "./dist/pipelines.node.mjs"
},
"react-native": "./dist/index.rn.js",
"browser": {
"require": "./dist/pipelines.cjs.js",
"import": "./dist/pipelines.esm.js"
},
"default": "./dist/pipelines.esm.js"
},
"./package.json": "./package.json"
},
"main": "dist/index.node.cjs.js",
@@ -97,7 +126,11 @@
"license": "Apache-2.0",
"files": [
"dist",
"lite/package.json"
"lite/package.json",
"pipelines/package.json",
"pipelines/pipelines.d.ts",
"lite/pipelines/package.json",
"lite/pipelines/pipelines.d.ts"
],
"dependencies": {
"@firebase/component": "0.7.0",
+14
View File
@@ -0,0 +1,14 @@
{
"name": "@firebase/firestore-pipelines",
"description": "pipelines",
"main": "../dist/pipelines.node.cjs.js",
"main-esm": "../dist/pipelines.node.mjs",
"module": "../dist/pipelines.esm.js",
"browser": "../dist/pipelines.esm.js",
"react-native": "../dist/pipelines.rn.js",
"typings": "./pipelines.d.ts",
"private": true,
"engines": {
"node": ">=20.0.0"
}
}
+28
View File
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PipelineSource, Pipeline } from '../dist/pipelines';
// Augment the Firestore and Query classes with the pipeline() method.
// This is stripped from dist/lite/pipelines.d.ts during the build
// so it needs to be re-added here.
declare module '@firebase/firestore' {
interface Firestore {
pipeline(): PipelineSource<Pipeline>;
}
}
export * from '../dist/pipelines';
@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from '../src/api_pipelines';
@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from '../src/api_pipelines';
+51
View File
@@ -0,0 +1,51 @@
/**
* Cloud Firestore
*
* @packageDocumentation
*/
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// External exports: ./api
// These external exports will be stripped from the dist/pipelines.d.ts file
// by the prune-dts script, in order to reduce type duplication. However, these
// types need to be exported here to ensure that api-extractor behaves
// correctly. If a type from api.ts is missing from this export, then
// api-extractor may rename it with a suffix `_#`, e.g. `YourType_2`.
export type {
Timestamp,
DocumentReference,
VectorValue,
GeoPoint,
FieldPath,
DocumentData,
Query,
Firestore,
FirestoreDataConverter,
WithFieldValue,
PartialWithFieldValue,
SetOptions,
QueryDocumentSnapshot,
SnapshotOptions,
Primitive,
FieldValue,
SnapshotMetadata,
Bytes
} from '../src/api';
export * from '../src/api_pipelines';
+47 -16
View File
@@ -26,6 +26,7 @@ import tmp from 'tmp';
import typescript from 'typescript';
import { generateBuildTargetReplaceConfig } from '../../scripts/build/rollup_replace_build_target';
import { replaceDeclareModule } from '../../scripts/build/rollup_replace_declare_module';
import pkg from './package.json';
import tsconfig from './tsconfig.json';
@@ -64,9 +65,11 @@ const allBuilds = [
// this is an intermediate build used to generate the actual esm and cjs builds
// which add build target reporting
{
input: './src/index.node.ts',
input: ['./src/index.node.ts', './pipelines/pipelines.node.ts'],
output: {
file: pkg['main-esm'],
dir: 'dist/intermediate',
entryFileNames: '[name].mjs',
chunkFileNames: 'common-[hash].node.mjs',
format: 'es',
sourcemap: true
},
@@ -79,9 +82,14 @@ const allBuilds = [
},
// Node CJS build
{
input: pkg['main-esm'],
input: [
'dist/intermediate/index.node.mjs',
'dist/intermediate/pipelines.node.mjs'
],
output: {
file: pkg.main,
dir: 'dist/',
entryFileNames: '[name].cjs.js',
chunkFileNames: 'common-[hash].node.cjs.js',
format: 'cjs',
sourcemap: true
},
@@ -106,9 +114,14 @@ const allBuilds = [
},
// Node ESM build with build target reporting
{
input: pkg['main-esm'],
input: [
'dist/intermediate/index.node.mjs',
'dist/intermediate/pipelines.node.mjs'
],
output: {
file: pkg['main-esm'],
dir: 'dist/',
entryFileNames: '[name].mjs',
chunkFileNames: 'common-[hash].node.mjs',
format: 'es',
sourcemap: true
},
@@ -125,9 +138,11 @@ const allBuilds = [
// this is an intermediate build used to generate the actual esm and cjs builds
// which add build target reporting
{
input: './src/index.ts',
input: ['./src/index.ts', './pipelines/pipelines.ts'],
output: {
file: pkg.browser,
dir: 'dist/intermediate',
entryFileNames: '[name].js',
chunkFileNames: 'common-[hash].js',
format: 'es',
sourcemap: true
},
@@ -139,10 +154,12 @@ const allBuilds = [
},
// Convert es2020 build to cjs
{
input: pkg['browser'],
input: ['dist/intermediate/index.js', 'dist/intermediate/pipelines.js'],
output: [
{
file: './dist/index.cjs.js',
dir: 'dist/',
entryFileNames: '[name].cjs.js',
chunkFileNames: 'common-[hash].cjs.js',
format: 'cjs',
sourcemap: true
}
@@ -158,10 +175,12 @@ const allBuilds = [
},
// es2020 build with build target reporting
{
input: pkg['browser'],
input: ['dist/intermediate/index.js', 'dist/intermediate/pipelines.js'],
output: [
{
file: pkg['browser'],
dir: 'dist/',
entryFileNames: '[name].esm.js',
chunkFileNames: 'common-[hash].esm.js',
format: 'es',
sourcemap: true
}
@@ -177,9 +196,11 @@ const allBuilds = [
},
// RN build
{
input: './src/index.rn.ts',
input: ['./src/index.rn.ts', './pipelines/pipelines.rn.ts'],
output: {
file: pkg['react-native'],
dir: 'dist/',
entryFileNames: '[name].js',
chunkFileNames: 'common-[hash].rn.js',
format: 'es',
sourcemap: true
},
@@ -194,7 +215,7 @@ const allBuilds = [
}
},
{
input: 'dist/firestore/src/index.d.ts',
input: 'dist/firestore/src/global.d.ts',
output: {
file: 'dist/firestore/src/global_index.d.ts',
format: 'es'
@@ -202,7 +223,17 @@ const allBuilds = [
plugins: [
dts({
respectExternal: true
})
}),
// The global.d.ts input file will include
// a `declare module './database' { ... }` block. This block
// was not removed in the build, and the module
// './database' is not known in context of the global.d.ts file.
// Use the declareModuleReplacePlugin to replace:
// `declare module './database' { Y }`
// with the contents of the block:
// `Y`
replaceDeclareModule('global_index.d.ts', './database')
]
}
];
+40 -14
View File
@@ -56,9 +56,11 @@ const allBuilds = [
// this is an intermediate build used to generate the actual esm and cjs builds
// which add build target reporting
{
input: './lite/index.ts',
input: ['./lite/index.ts', './lite/pipelines/pipelines.ts'],
output: {
file: path.resolve('./lite', pkg['main-esm']),
dir: 'dist/intermediate/lite/',
entryFileNames: '[name].node.mjs',
chunkFileNames: 'common-[hash].node.mjs',
format: 'es',
sourcemap: true
},
@@ -77,9 +79,14 @@ const allBuilds = [
},
// Node CJS build
{
input: path.resolve('./lite', pkg['main-esm']),
input: [
'dist/intermediate/lite/index.node.mjs',
'dist/intermediate/lite/pipelines.node.mjs'
],
output: {
file: path.resolve('./lite', pkg.main),
dir: 'dist/lite/',
entryFileNames: '[name].cjs.js',
chunkFileNames: 'common-[hash].node.cjs.js',
format: 'cjs',
sourcemap: true
},
@@ -102,9 +109,14 @@ const allBuilds = [
},
// Node ESM build
{
input: path.resolve('./lite', pkg['main-esm']),
input: [
'dist/intermediate/lite/index.node.mjs',
'dist/intermediate/lite/pipelines.node.mjs'
],
output: {
file: path.resolve('./lite', pkg['main-esm']),
dir: 'dist/lite/',
entryFileNames: '[name].mjs',
chunkFileNames: 'common-[hash].node.mjs',
format: 'es',
sourcemap: true
},
@@ -121,9 +133,11 @@ const allBuilds = [
// this is an intermediate build used to generate the actual esm and cjs builds
// which add build target reporting
{
input: './lite/index.ts',
input: ['./lite/index.ts', './lite/pipelines/pipelines.ts'],
output: {
file: path.resolve('./lite', pkg.browser),
dir: 'dist/intermediate/lite/',
entryFileNames: '[name].browser.js',
chunkFileNames: 'common-[hash].browser.js',
format: 'es',
sourcemap: true
},
@@ -142,10 +156,15 @@ const allBuilds = [
},
// Convert es2020 build to CJS
{
input: path.resolve('./lite', pkg.browser),
input: [
'dist/intermediate/lite/index.browser.js',
'dist/intermediate/lite/pipelines.browser.js'
],
output: [
{
file: './dist/lite/index.cjs.js',
dir: 'dist/lite/',
entryFileNames: '[name].cjs.js',
chunkFileNames: 'common-[hash].cjs.js',
format: 'es',
sourcemap: true
}
@@ -161,10 +180,15 @@ const allBuilds = [
},
// Browser es2020 build
{
input: path.resolve('./lite', pkg.browser),
input: [
'dist/intermediate/lite/index.browser.js',
'dist/intermediate/lite/pipelines.browser.js'
],
output: [
{
file: path.resolve('./lite', pkg.browser),
dir: 'dist/lite/',
entryFileNames: '[name].esm.js',
chunkFileNames: 'common-[hash].esm.js',
format: 'es',
sourcemap: true
}
@@ -180,9 +204,11 @@ const allBuilds = [
},
// RN build
{
input: './lite/index.ts',
input: ['./lite/index.ts', './lite/pipelines/pipelines.ts'],
output: {
file: path.resolve('./lite', pkg['react-native']),
dir: 'dist/lite/',
entryFileNames: '[name].rn.esm.js',
chunkFileNames: 'common-[hash].rn.esm.js',
format: 'es',
sourcemap: true
},
+7 -3
View File
@@ -15,17 +15,21 @@
* limitations under the License.
*/
import { AggregateField, AggregateSpec, DocumentData, Query } from '../api';
import { AggregateImpl } from '../core/aggregate';
import { firestoreClientRunAggregateQuery } from '../core/firestore_client';
import { count } from '../lite-api/aggregate';
import { AggregateQuerySnapshot } from '../lite-api/aggregate_types';
import {
AggregateField,
AggregateQuerySnapshot,
AggregateSpec
} from '../lite-api/aggregate_types';
import { DocumentData, Query } from '../lite-api/reference';
import { ApiClientObjectMap, Value } from '../protos/firestore_proto_api';
import { cast } from '../util/input_validation';
import { mapToArray } from '../util/obj';
import { ensureFirestoreConfigured, Firestore } from './database';
import { ExpUserDataWriter } from './reference_impl';
import { ExpUserDataWriter } from './user_data_writer';
export {
aggregateQuerySnapshotEqual,
+1
View File
@@ -302,6 +302,7 @@ export function configureFirestore(firestore: Firestore): void {
firestore._databaseId,
firestore._app?.options.appId || '',
firestore._persistenceKey,
firestore._app?.options.apiKey,
settings
);
if (!firestore._componentsProvider) {
@@ -16,8 +16,53 @@
*/
import { DatabaseId } from '../core/database_info';
import { UserDataSource } from '../lite-api/user_data_reader';
import { DocumentKey } from '../model/document_key';
import { FieldTransform } from '../model/mutation';
import { FieldPath as InternalFieldPath } from '../model/path';
import { JsonProtoSerializer } from '../remote/serializer';
import { FirestoreError } from '../util/error';
/** Contains the settings that are mutated as we parse user data. */
export interface ContextSettings {
/** Indicates what kind of API method this data came from. */
readonly dataSource: UserDataSource;
/** The name of the method the user called to create the ParseContext. */
readonly methodName: string;
/** The document the user is attempting to modify, if that applies. */
readonly targetDoc?: DocumentKey;
/**
* A path within the object being parsed. This could be an empty path (in
* which case the context represents the root of the data being parsed), or a
* nonempty path (indicating the context represents a nested location within
* the data).
*/
readonly path?: InternalFieldPath;
/**
* Whether or not this context corresponds to an element of an array.
* If not set, elements are treated as if they were outside of arrays.
*/
readonly arrayElement?: boolean;
/**
* Whether or not a converter was specified in this context. If true, error
* messages will reference the converter when invalid data is provided.
*/
readonly hasConverter?: boolean;
}
export interface ParseContext {
readonly settings: ContextSettings;
readonly databaseId: DatabaseId;
readonly serializer: JsonProtoSerializer;
readonly ignoreUndefinedProperties: boolean;
fieldTransforms: FieldTransform[];
fieldMask: InternalFieldPath[];
get path(): InternalFieldPath | undefined;
get dataSource(): UserDataSource;
contextWith(configuration: Partial<ContextSettings>): ParseContext;
childContextForField(field: string): ParseContext;
childContextForFieldPath(field: InternalFieldPath): ParseContext;
childContextForArray(index: number): ParseContext;
createError(reason: string): FirestoreError;
contains(fieldPath: InternalFieldPath): boolean;
}
+47
View File
@@ -0,0 +1,47 @@
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Pipeline as LitePipeline } from '../lite-api/pipeline';
import { Stage } from '../lite-api/stage';
import { UserDataReader } from '../lite-api/user_data_reader';
import { AbstractUserDataWriter } from '../lite-api/user_data_writer';
import { Firestore } from './database';
/**
* @beta
*/
export class Pipeline extends LitePipeline {
/**
* @internal
* @private
* @param db
* @param userDataReader
* @param userDataWriter
* @param stages
* @param converter
* @protected
*/
protected newPipeline(
db: Firestore,
userDataReader: UserDataReader,
userDataWriter: AbstractUserDataWriter,
stages: Stage[]
): Pipeline {
return new Pipeline(db, userDataReader, userDataWriter, stages);
}
}
+216
View File
@@ -0,0 +1,216 @@
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Pipeline } from '../api/pipeline';
import { firestoreClientExecutePipeline } from '../core/firestore_client';
import {
StructuredPipeline,
StructuredPipelineOptions
} from '../core/structured_pipeline';
import { Pipeline as LitePipeline } from '../lite-api/pipeline';
import { PipelineResult, PipelineSnapshot } from '../lite-api/pipeline-result';
import { PipelineSource } from '../lite-api/pipeline-source';
import { PipelineExecuteOptions } from '../lite-api/pipeline_options';
import { Stage } from '../lite-api/stage';
import {
newUserDataReader,
UserDataReader,
UserDataSource
} from '../lite-api/user_data_reader';
import { cast } from '../util/input_validation';
import { ensureFirestoreConfigured, Firestore } from './database';
import { DocumentReference } from './reference';
import { ExpUserDataWriter } from './user_data_writer';
declare module './database' {
/**
* @beta
* Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link Pipeline}.
*
* @example
* ```
* let myPipeline: Pipeline = firestore.pipeline().collection('books');
* ```
*/
interface Firestore {
pipeline(): PipelineSource<Pipeline>;
}
}
/**
* @beta
* Executes a pipeline and returns a Promise to represent the asynchronous operation.
*
* The returned Promise can be used to track the progress of the pipeline execution
* and retrieve the results (or handle any errors) asynchronously.
*
* The pipeline results are returned as a {@link PipelineSnapshot} that contains
* a list of {@link PipelineResult} objects. Each {@link PipelineResult} typically
* represents a single key/value map that has passed through all the
* stages of the pipeline, however this might differ depending on the stages involved in the
* pipeline. For example:
*
* <ul>
* <li>If there are no stages or only transformation stages, each {@link PipelineResult}
* represents a single document.</li>
* <li>If there is an aggregation, only a single {@link PipelineResult} is returned,
* representing the aggregated results over the entire dataset .</li>
* <li>If there is an aggregation stage with grouping, each {@link PipelineResult} represents a
* distinct group and its associated aggregated values.</li>
* </ul>
*
* <p>Example:
*
* ```typescript
* const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books")
* .where(gt(field("rating"), 4.5))
* .select("title", "author", "rating"));
*
* const results: PipelineResults = snapshot.results;
* ```
*
* @param pipeline The pipeline to execute.
* @return A Promise representing the asynchronous pipeline execution.
*/
export function execute(pipeline: LitePipeline): Promise<PipelineSnapshot>;
/**
* @beta
* Executes a pipeline and returns a Promise to represent the asynchronous operation.
*
* The returned Promise can be used to track the progress of the pipeline execution
* and retrieve the results (or handle any errors) asynchronously.
*
* The pipeline results are returned as a {@link PipelineSnapshot} that contains
* a list of {@link PipelineResult} objects. Each {@link PipelineResult} typically
* represents a single key/value map that has passed through all the
* stages of the pipeline, however this might differ depending on the stages involved in the
* pipeline. For example:
*
* <ul>
* <li>If there are no stages or only transformation stages, each {@link PipelineResult}
* represents a single document.</li>
* <li>If there is an aggregation, only a single {@link PipelineResult} is returned,
* representing the aggregated results over the entire dataset .</li>
* <li>If there is an aggregation stage with grouping, each {@link PipelineResult} represents a
* distinct group and its associated aggregated values.</li>
* </ul>
*
* <p>Example:
*
* ```typescript
* const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books")
* .where(gt(field("rating"), 4.5))
* .select("title", "author", "rating"));
*
* const results: PipelineResults = snapshot.results;
* ```
*
* @param options Specifies the pipeline to execute and other options for execute.
* @return A Promise representing the asynchronous pipeline execution.
*/
export function execute(
options: PipelineExecuteOptions
): Promise<PipelineSnapshot>;
export function execute(
pipelineOrOptions: LitePipeline | PipelineExecuteOptions
): Promise<PipelineSnapshot> {
const options: PipelineExecuteOptions = !(
pipelineOrOptions instanceof LitePipeline
)
? pipelineOrOptions
: {
pipeline: pipelineOrOptions
};
const { pipeline, rawOptions, ...rest } = options;
const firestore = cast(pipeline._db, Firestore);
const client = ensureFirestoreConfigured(firestore);
const udr = new UserDataReader(
firestore._databaseId,
/* ignoreUndefinedProperties */ true
);
const context = udr.createContext(UserDataSource.Argument, 'execute');
const structuredPipelineOptions = new StructuredPipelineOptions(
rest,
rawOptions
);
structuredPipelineOptions._readUserData(context);
const structuredPipeline: StructuredPipeline = new StructuredPipeline(
pipeline,
structuredPipelineOptions
);
return firestoreClientExecutePipeline(client, structuredPipeline).then(
result => {
// Get the execution time from the first result.
// firestoreClientExecutePipeline returns at least one PipelineStreamElement
// even if the returned document set is empty.
const executionTime =
result.length > 0 ? result[0].executionTime?.toTimestamp() : undefined;
const docs = result
// Currently ignore any response from ExecutePipeline that does
// not contain any document data in the `fields` property.
.filter(element => !!element.fields)
.map(
element =>
new PipelineResult(
pipeline._userDataWriter,
element.fields!,
element.key?.path
? new DocumentReference(firestore, null, element.key)
: undefined,
element.createTime?.toTimestamp(),
element.updateTime?.toTimestamp()
)
);
return new PipelineSnapshot(pipeline, docs, executionTime);
}
);
}
/**
* @beta
* Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link Pipeline}.
*
* @example
* ```
* let myPipeline: Pipeline = firestore.pipeline().collection('books');
* ```
*/
// Augment the Firestore class with the pipeline() factory method
Firestore.prototype.pipeline = function (): PipelineSource<Pipeline> {
const userDataReader = newUserDataReader(this);
return new PipelineSource<Pipeline>(
this._databaseId,
userDataReader,
(stages: Stage[]) => {
return new Pipeline(
this,
userDataReader,
new ExpUserDataWriter(this),
stages
);
}
);
};
+1 -18
View File
@@ -37,7 +37,6 @@ import {
} from '../core/firestore_client';
import { newQueryForPath, Query as InternalQuery } from '../core/query';
import { ViewSnapshot } from '../core/view_snapshot';
import { Bytes } from '../lite-api/bytes';
import { FieldPath } from '../lite-api/field_path';
import { validateHasExplicitOrderByForLimitToLast } from '../lite-api/query';
import {
@@ -59,11 +58,9 @@ import {
parseUpdateData,
parseUpdateVarargs
} from '../lite-api/user_data_reader';
import { AbstractUserDataWriter } from '../lite-api/user_data_writer';
import { DocumentKey } from '../model/document_key';
import { DeleteMutation, Mutation, Precondition } from '../model/mutation';
import { debugAssert } from '../util/assert';
import { ByteString } from '../util/byte_string';
import { Code, FirestoreError } from '../util/error';
import { cast } from '../util/input_validation';
@@ -74,6 +71,7 @@ import {
QuerySnapshot,
SnapshotMetadata
} from './snapshot';
import { ExpUserDataWriter } from './user_data_writer';
/**
* An options object that can be passed to {@link (onSnapshot:1)} and {@link
@@ -130,21 +128,6 @@ export function getDoc<AppModelType, DbModelType extends DocumentData>(
).then(snapshot => convertToDocSnapshot(firestore, reference, snapshot));
}
export class ExpUserDataWriter extends AbstractUserDataWriter {
constructor(protected firestore: Firestore) {
super();
}
protected convertBytes(bytes: ByteString): Bytes {
return new Bytes(bytes);
}
protected convertReference(name: string): DocumentReference {
const key = this.convertDocumentKey(name, this.firestore._databaseId);
return new DocumentReference(this.firestore, /* converter= */ null, key);
}
}
/**
* Reads the document referred to by this `DocumentReference` from cache.
* Returns an error if the document is not currently cached.
+4 -2
View File
@@ -31,10 +31,12 @@ import {
import { LiteUserDataWriter } from '../lite-api/reference_impl';
import {
DocumentSnapshot as LiteDocumentSnapshot,
fieldPathFromArgument,
FirestoreDataConverter as LiteFirestoreDataConverter
} from '../lite-api/snapshot';
import { UntypedFirestoreDataConverter } from '../lite-api/user_data_reader';
import {
fieldPathFromArgument,
UntypedFirestoreDataConverter
} from '../lite-api/user_data_reader';
import { AbstractUserDataWriter } from '../lite-api/user_data_writer';
import { fromBundledQuery } from '../local/local_serializer';
import { documentKeySet } from '../model/collections';

Some files were not shown because too many files have changed in this diff Show More