Skip to content

Commit d0c864c

Browse files
committed
update documents
1 parent b7d9767 commit d0c864c

File tree

11 files changed

+203
-731
lines changed

11 files changed

+203
-731
lines changed

common/api-review/firestore-lite-pipelines.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ export function arrayContainsAny(array: Expression, values: Expression): Boolean
108108
export function arrayContainsAny(fieldName: string, values: Expression): BooleanExpression;
109109

110110
// @beta
111-
export function arrayFilter(fieldName: string, variable: string, predicate: Expression): FunctionExpression;
111+
export function arrayFilter(fieldName: string, variable: string, predicate: BooleanExpression): FunctionExpression;
112112

113113
// @beta
114-
export function arrayFilter(arrayExpression: Expression, variable: string, predicate: Expression): FunctionExpression;
114+
export function arrayFilter(arrayExpression: Expression, variable: string, predicate: BooleanExpression): FunctionExpression;
115115

116116
// @beta
117117
export function arrayFirst(fieldName: string): FunctionExpression;
@@ -493,7 +493,7 @@ export abstract class Expression {
493493
/* Excluded from this release type: _readUserData */
494494
arrayContainsAny(arrayExpression: Expression): BooleanExpression;
495495
/* Excluded from this release type: _readUserData */
496-
arrayFilter(variable: string, predicate: Expression): FunctionExpression;
496+
arrayFilter(variable: string, predicate: BooleanExpression): FunctionExpression;
497497
/* Excluded from this release type: _readUserData */
498498
arrayFirst(): FunctionExpression;
499499
/* Excluded from this release type: _readUserData */

common/api-review/firestore-pipelines.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ export function arrayContainsAny(array: Expression, values: Expression): Boolean
108108
export function arrayContainsAny(fieldName: string, values: Expression): BooleanExpression;
109109

110110
// @beta
111-
export function arrayFilter(fieldName: string, variable: string, predicate: Expression): FunctionExpression;
111+
export function arrayFilter(fieldName: string, variable: string, predicate: BooleanExpression): FunctionExpression;
112112

113113
// @beta
114-
export function arrayFilter(arrayExpression: Expression, variable: string, predicate: Expression): FunctionExpression;
114+
export function arrayFilter(arrayExpression: Expression, variable: string, predicate: BooleanExpression): FunctionExpression;
115115

116116
// @beta
117117
export function arrayFirst(fieldName: string): FunctionExpression;
@@ -496,7 +496,7 @@ export abstract class Expression {
496496
/* Excluded from this release type: _readUserData */
497497
arrayContainsAny(arrayExpression: Expression): BooleanExpression;
498498
/* Excluded from this release type: _readUserData */
499-
arrayFilter(variable: string, predicate: Expression): FunctionExpression;
499+
arrayFilter(variable: string, predicate: BooleanExpression): FunctionExpression;
500500
/* Excluded from this release type: _readUserData */
501501
arrayFirst(): FunctionExpression;
502502
/* Excluded from this release type: _readUserData */

docs-devsite/firestore_lite_pipelines.expression.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -513,28 +513,28 @@ Returns a filtered array containing only elements that match the predicate.
513513
<b>Signature:</b>
514514

515515
```typescript
516-
arrayFilter(variable: string, predicate: Expression): FunctionExpression;
516+
arrayFilter(variable: string, predicate: BooleanExpression): FunctionExpression;
517517
```
518518

519519
#### Parameters
520520

521521
| Parameter | Type | Description |
522522
| --- | --- | --- |
523-
| variable | string | The variable name to bind to each element. |
524-
| predicate | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The predicate expression to filter by. |
523+
| variable | string | The variable name to bind to each element in the array. This variable name can be used in the <code>predicate</code> expression to refer to the current element. |
524+
| predicate | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The predicate boolean expression to filter by. |
525525

526526
<b>Returns:</b>
527527

528528
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
529529

530-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the filtered array.
530+
A new `Expression` representing the filtered array.
531531

532532
### Example
533533

534534

535535
```typescript
536-
// Get a filtered array of the 'myArray' field containing only elements that match the predicate.
537-
field("myArray").arrayFilter("element", element.eq(3));
536+
// Get a filtered array of the 'scores' field containing only elements greater than 50.
537+
field("scores").arrayFilter("score", field("score").greaterThan(50));
538538

539539
```
540540

@@ -554,7 +554,7 @@ arrayFirst(): FunctionExpression;
554554

555555
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
556556

557-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the first element.
557+
A new `Expression` representing the first element.
558558

559559
### Example
560560

@@ -588,7 +588,7 @@ arrayFirstN(n: number): FunctionExpression;
588588

589589
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
590590

591-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the first `n` elements.
591+
A new `Expression` representing the first `n` elements.
592592

593593
### Example
594594

@@ -616,13 +616,13 @@ arrayFirstN(n: Expression): FunctionExpression;
616616

617617
| Parameter | Type | Description |
618618
| --- | --- | --- |
619-
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of elements to return. |
619+
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the number of elements to return. |
620620

621621
<b>Returns:</b>
622622

623623
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
624624

625-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the first `n` elements.
625+
A new `Expression` representing the first `n` elements.
626626

627627
### Example
628628

@@ -725,7 +725,7 @@ arrayIndexOf(search: unknown): FunctionExpression;
725725

726726
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
727727

728-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the index.
728+
A new `Expression` representing the index.
729729

730730
### Example
731731

@@ -753,13 +753,13 @@ arrayIndexOf(search: Expression): FunctionExpression;
753753

754754
| Parameter | Type | Description |
755755
| --- | --- | --- |
756-
| search | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the value to search for. |
756+
| search | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the value to search for. |
757757

758758
<b>Returns:</b>
759759

760760
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
761761

762-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the index.
762+
A new `Expression` representing the index.
763763

764764
### Example
765765

@@ -793,7 +793,7 @@ arrayIndexOfAll(search: unknown): FunctionExpression;
793793

794794
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
795795

796-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the indices.
796+
A new `Expression` representing the indices.
797797

798798
### Example
799799

@@ -821,13 +821,13 @@ arrayIndexOfAll(search: Expression): FunctionExpression;
821821

822822
| Parameter | Type | Description |
823823
| --- | --- | --- |
824-
| search | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the value to search for. |
824+
| search | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the value to search for. |
825825

826826
<b>Returns:</b>
827827

828828
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
829829

830-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the indices.
830+
A new `Expression` representing the indices.
831831

832832
### Example
833833

@@ -854,7 +854,7 @@ arrayLast(): FunctionExpression;
854854

855855
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
856856

857-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the last element.
857+
A new `Expression` representing the last element.
858858

859859
### Example
860860

@@ -888,7 +888,7 @@ arrayLastIndexOf(search: unknown): FunctionExpression;
888888

889889
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
890890

891-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the index.
891+
A new `Expression` representing the index.
892892

893893
### Example
894894

@@ -916,13 +916,13 @@ arrayLastIndexOf(search: Expression): FunctionExpression;
916916

917917
| Parameter | Type | Description |
918918
| --- | --- | --- |
919-
| search | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the value to search for. |
919+
| search | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the value to search for. |
920920

921921
<b>Returns:</b>
922922

923923
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
924924

925-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the index.
925+
A new `Expression` representing the index.
926926

927927
### Example
928928

@@ -956,7 +956,7 @@ arrayLastN(n: number): FunctionExpression;
956956

957957
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
958958

959-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the last `n` elements.
959+
A new `Expression` representing the last `n` elements.
960960

961961
### Example
962962

@@ -984,13 +984,13 @@ arrayLastN(n: Expression): FunctionExpression;
984984

985985
| Parameter | Type | Description |
986986
| --- | --- | --- |
987-
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of elements to return. |
987+
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the number of elements to return. |
988988

989989
<b>Returns:</b>
990990

991991
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
992992

993-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the last `n` elements.
993+
A new `Expression` representing the last `n` elements.
994994

995995
### Example
996996

@@ -1044,7 +1044,7 @@ arrayMaximum(): FunctionExpression;
10441044

10451045
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
10461046

1047-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the maximum value.
1047+
A new `Expression` representing the maximum value.
10481048

10491049
### Example
10501050

@@ -1078,7 +1078,7 @@ arrayMaximumN(n: number): FunctionExpression;
10781078

10791079
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
10801080

1081-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the largest `n` elements.
1081+
A new `Expression` representing the largest `n` elements.
10821082

10831083
### Example
10841084

@@ -1106,13 +1106,13 @@ arrayMaximumN(n: Expression): FunctionExpression;
11061106

11071107
| Parameter | Type | Description |
11081108
| --- | --- | --- |
1109-
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of elements to return. |
1109+
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the number of elements to return. |
11101110

11111111
<b>Returns:</b>
11121112

11131113
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
11141114

1115-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the largest `n` elements.
1115+
A new `Expression` representing the largest `n` elements.
11161116

11171117
### Example
11181118

@@ -1139,7 +1139,7 @@ arrayMinimum(): FunctionExpression;
11391139

11401140
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
11411141

1142-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the minimum value.
1142+
A new `Expression` representing the minimum value.
11431143

11441144
### Example
11451145

@@ -1173,7 +1173,7 @@ arrayMinimumN(n: number): FunctionExpression;
11731173

11741174
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
11751175

1176-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the smallest `n` elements.
1176+
A new `Expression` representing the smallest `n` elements.
11771177

11781178
### Example
11791179

@@ -1201,13 +1201,13 @@ arrayMinimumN(n: Expression): FunctionExpression;
12011201

12021202
| Parameter | Type | Description |
12031203
| --- | --- | --- |
1204-
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of elements to return. |
1204+
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the number of elements to return. |
12051205

12061206
<b>Returns:</b>
12071207

12081208
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
12091209

1210-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the smallest `n` elements.
1210+
A new `Expression` representing the smallest `n` elements.
12111211

12121212
### Example
12131213

@@ -1269,7 +1269,7 @@ arraySlice(start: number, end?: number): FunctionExpression;
12691269

12701270
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
12711271

1272-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the slice.
1272+
A new `Expression` representing the slice.
12731273

12741274
### Example
12751275

@@ -1297,21 +1297,21 @@ arraySlice(start: Expression, end?: Expression): FunctionExpression;
12971297

12981298
| Parameter | Type | Description |
12991299
| --- | --- | --- |
1300-
| start | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the index to start the slice. |
1301-
| end | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the index to end the slice (inclusive). |
1300+
| start | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the index to start the slice. |
1301+
| end | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to the index to end the slice (inclusive). |
13021302

13031303
<b>Returns:</b>
13041304

13051305
[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
13061306

1307-
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the slice.
1307+
A new `Expression` representing the slice.
13081308

13091309
### Example
13101310

13111311

13121312
```typescript
13131313
// Get a slice of the 'myArray' field from index value in 'start' field to
1314-
index value in 'end' field (inclusive).
1314+
// index value in 'end' field (inclusive).
13151315
field("myArray").arraySlice(field("start"), field("end"));
13161316

13171317
```

0 commit comments

Comments
 (0)