Skip to content

Commit b7d9767

Browse files
committed
update documentation
1 parent 4889715 commit b7d9767

File tree

5 files changed

+52
-27
lines changed

5 files changed

+52
-27
lines changed

docs-devsite/firestore_lite_pipelines.expression.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ export declare abstract class Expression
5252
| [arrayFirstN(n)](./firestore_lite_pipelines.expression.md#expressionarrayfirstn) | | <b><i>(Public Preview)</i></b> Returns the first <code>n</code> elements of the array. |
5353
| [arrayGet(offset)](./firestore_lite_pipelines.expression.md#expressionarrayget) | | <b><i>(Public Preview)</i></b> Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. |
5454
| [arrayGet(offsetExpr)](./firestore_lite_pipelines.expression.md#expressionarrayget) | | <b><i>(Public Preview)</i></b> Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. |
55-
| [arrayIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or null if not found. |
56-
| [arrayIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or null if not found. |
55+
| [arrayIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or -1 if not found. |
56+
| [arrayIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or -1 if not found. |
5757
| [arrayIndexOfAll(search)](./firestore_lite_pipelines.expression.md#expressionarrayindexofall) | | <b><i>(Public Preview)</i></b> Returns all indices of the search value in the array. |
5858
| [arrayIndexOfAll(search)](./firestore_lite_pipelines.expression.md#expressionarrayindexofall) | | <b><i>(Public Preview)</i></b> Returns all indices of the search value in the array. |
5959
| [arrayLast()](./firestore_lite_pipelines.expression.md#expressionarraylast) | | <b><i>(Public Preview)</i></b> Returns the last element of the array. |
60-
| [arrayLastIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or null if not found. |
61-
| [arrayLastIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or null if not found. |
60+
| [arrayLastIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or -1 if not found. |
61+
| [arrayLastIndexOf(search)](./firestore_lite_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or -1 if not found. |
6262
| [arrayLastN(n)](./firestore_lite_pipelines.expression.md#expressionarraylastn) | | <b><i>(Public Preview)</i></b> Returns the last <code>n</code> elements of the array. |
6363
| [arrayLastN(n)](./firestore_lite_pipelines.expression.md#expressionarraylastn) | | <b><i>(Public Preview)</i></b> Returns the last <code>n</code> elements of the array. |
6464
| [arrayLength()](./firestore_lite_pipelines.expression.md#expressionarraylength) | | <b><i>(Public Preview)</i></b> Creates an expression that calculates the length of an array. |
@@ -707,7 +707,7 @@ field('tags').arrayGet(field('favoriteTag'));
707707
> 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.
708708
>
709709

710-
Returns the first index of the search value in the array, or null if not found.
710+
Returns the first index of the search value in the array, or -1 if not found.
711711

712712
<b>Signature:</b>
713713

@@ -741,7 +741,7 @@ field("myArray").arrayIndexOf(3);
741741
> 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.
742742
>
743743

744-
Returns the first index of the search value in the array, or null if not found.
744+
Returns the first index of the search value in the array, or -1 if not found.
745745

746746
<b>Signature:</b>
747747

@@ -870,7 +870,7 @@ field("myArray").arrayLast();
870870
> 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.
871871
>
872872

873-
Returns the last index of the search value in the array, or null if not found.
873+
Returns the last index of the search value in the array, or -1 if not found.
874874

875875
<b>Signature:</b>
876876

@@ -890,12 +890,21 @@ arrayLastIndexOf(search: unknown): FunctionExpression;
890890

891891
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the index.
892892

893+
### Example
894+
895+
896+
```typescript
897+
// Get the last index of the value 3 in the 'myArray' field.
898+
field("myArray").arrayLastIndexOf(3);
899+
900+
```
901+
893902
## Expression.arrayLastIndexOf()
894903

895904
> 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.
896905
>
897906

898-
Returns the last index of the search value in the array, or null if not found.
907+
Returns the last index of the search value in the array, or -1 if not found.
899908

900909
<b>Signature:</b>
901910

docs-devsite/firestore_lite_pipelines.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ https://github.com/firebase/firebase-js-sdk
3636
| [arrayIndexOf(arrayExpression, search)](./firestore_lite_pipelines.md#arrayindexof_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns the first index of the search value in an array. Returns -1 if the value is not found. |
3737
| [arrayIndexOfAll(arrayExpression, search)](./firestore_lite_pipelines.md#arrayindexofall_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns all indices of the search value in an array. |
3838
| [arrayLast(arrayExpression)](./firestore_lite_pipelines.md#arraylast_f574e12) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last element of an array. |
39-
| [arrayLastIndexOf(arrayExpression, search)](./firestore_lite_pipelines.md#arraylastindexof_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last index of the search value in an array. |
39+
| [arrayLastIndexOf(arrayExpression, search)](./firestore_lite_pipelines.md#arraylastindexof_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last index of the search value in an array. Returns -1 if the value is not found. |
4040
| [arrayLastN(arrayExpression, n)](./firestore_lite_pipelines.md#arraylastn_bff7f91) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last <code>n</code> elements of an array. |
4141
| [arrayLastN(arrayExpression, n)](./firestore_lite_pipelines.md#arraylastn_19b4ef8) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last <code>n</code> elements of an array. |
4242
| [arrayMaximum(arrayExpression)](./firestore_lite_pipelines.md#arraymaximum_f574e12) | <b><i>(Public Preview)</i></b> Creates an expression that returns the maximum value in an array. |
@@ -1043,7 +1043,7 @@ arrayLast(field("tags"));
10431043
> 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.
10441044
>
10451045
1046-
Creates an expression that returns the last index of the search value in an array.
1046+
Creates an expression that returns the last index of the search value in an array. Returns -1 if the value is not found.
10471047

10481048
<b>Signature:</b>
10491049

@@ -4528,7 +4528,7 @@ export declare function arrayMinimumN(fieldName: string, n: Expression): Functio
45284528
45294529
| Parameter | Type | Description |
45304530
| --- | --- | --- |
4531-
| fieldName | string | |
4531+
| fieldName | string | The name of the field containing the array. |
45324532
| n | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of elements to return. |
45334533
45344534
<b>Returns:</b>

docs-devsite/firestore_pipelines.expression.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ export declare abstract class Expression
5252
| [arrayFirstN(n)](./firestore_pipelines.expression.md#expressionarrayfirstn) | | <b><i>(Public Preview)</i></b> Returns the first <code>n</code> elements of the array. |
5353
| [arrayGet(offset)](./firestore_pipelines.expression.md#expressionarrayget) | | <b><i>(Public Preview)</i></b> Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. |
5454
| [arrayGet(offsetExpr)](./firestore_pipelines.expression.md#expressionarrayget) | | <b><i>(Public Preview)</i></b> Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. |
55-
| [arrayIndexOf(search)](./firestore_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or null if not found. |
56-
| [arrayIndexOf(search)](./firestore_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or null if not found. |
55+
| [arrayIndexOf(search)](./firestore_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or -1 if not found. |
56+
| [arrayIndexOf(search)](./firestore_pipelines.expression.md#expressionarrayindexof) | | <b><i>(Public Preview)</i></b> Returns the first index of the search value in the array, or -1 if not found. |
5757
| [arrayIndexOfAll(search)](./firestore_pipelines.expression.md#expressionarrayindexofall) | | <b><i>(Public Preview)</i></b> Returns all indices of the search value in the array. |
5858
| [arrayIndexOfAll(search)](./firestore_pipelines.expression.md#expressionarrayindexofall) | | <b><i>(Public Preview)</i></b> Returns all indices of the search value in the array. |
5959
| [arrayLast()](./firestore_pipelines.expression.md#expressionarraylast) | | <b><i>(Public Preview)</i></b> Returns the last element of the array. |
60-
| [arrayLastIndexOf(search)](./firestore_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or null if not found. |
61-
| [arrayLastIndexOf(search)](./firestore_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or null if not found. |
60+
| [arrayLastIndexOf(search)](./firestore_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or -1 if not found. |
61+
| [arrayLastIndexOf(search)](./firestore_pipelines.expression.md#expressionarraylastindexof) | | <b><i>(Public Preview)</i></b> Returns the last index of the search value in the array, or -1 if not found. |
6262
| [arrayLastN(n)](./firestore_pipelines.expression.md#expressionarraylastn) | | <b><i>(Public Preview)</i></b> Returns the last <code>n</code> elements of the array. |
6363
| [arrayLastN(n)](./firestore_pipelines.expression.md#expressionarraylastn) | | <b><i>(Public Preview)</i></b> Returns the last <code>n</code> elements of the array. |
6464
| [arrayLength()](./firestore_pipelines.expression.md#expressionarraylength) | | <b><i>(Public Preview)</i></b> Creates an expression that calculates the length of an array. |
@@ -707,7 +707,7 @@ field('tags').arrayGet(field('favoriteTag'));
707707
> 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.
708708
>
709709

710-
Returns the first index of the search value in the array, or null if not found.
710+
Returns the first index of the search value in the array, or -1 if not found.
711711

712712
<b>Signature:</b>
713713

@@ -741,7 +741,7 @@ field("myArray").arrayIndexOf(3);
741741
> 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.
742742
>
743743

744-
Returns the first index of the search value in the array, or null if not found.
744+
Returns the first index of the search value in the array, or -1 if not found.
745745

746746
<b>Signature:</b>
747747

@@ -870,7 +870,7 @@ field("myArray").arrayLast();
870870
> 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.
871871
>
872872

873-
Returns the last index of the search value in the array, or null if not found.
873+
Returns the last index of the search value in the array, or -1 if not found.
874874

875875
<b>Signature:</b>
876876

@@ -890,12 +890,21 @@ arrayLastIndexOf(search: unknown): FunctionExpression;
890890

891891
A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the index.
892892

893+
### Example
894+
895+
896+
```typescript
897+
// Get the last index of the value 3 in the 'myArray' field.
898+
field("myArray").arrayLastIndexOf(3);
899+
900+
```
901+
893902
## Expression.arrayLastIndexOf()
894903

895904
> 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.
896905
>
897906

898-
Returns the last index of the search value in the array, or null if not found.
907+
Returns the last index of the search value in the array, or -1 if not found.
899908

900909
<b>Signature:</b>
901910

docs-devsite/firestore_pipelines.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ https://github.com/firebase/firebase-js-sdk
3636
| [arrayIndexOf(arrayExpression, search)](./firestore_pipelines.md#arrayindexof_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns the first index of the search value in an array. Returns -1 if the value is not found. |
3737
| [arrayIndexOfAll(arrayExpression, search)](./firestore_pipelines.md#arrayindexofall_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns all indices of the search value in an array. |
3838
| [arrayLast(arrayExpression)](./firestore_pipelines.md#arraylast_f574e12) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last element of an array. |
39-
| [arrayLastIndexOf(arrayExpression, search)](./firestore_pipelines.md#arraylastindexof_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last index of the search value in an array. |
39+
| [arrayLastIndexOf(arrayExpression, search)](./firestore_pipelines.md#arraylastindexof_694a0b4) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last index of the search value in an array. Returns -1 if the value is not found. |
4040
| [arrayLastN(arrayExpression, n)](./firestore_pipelines.md#arraylastn_bff7f91) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last <code>n</code> elements of an array. |
4141
| [arrayLastN(arrayExpression, n)](./firestore_pipelines.md#arraylastn_19b4ef8) | <b><i>(Public Preview)</i></b> Creates an expression that returns the last <code>n</code> elements of an array. |
4242
| [arrayMaximum(arrayExpression)](./firestore_pipelines.md#arraymaximum_f574e12) | <b><i>(Public Preview)</i></b> Creates an expression that returns the maximum value in an array. |
@@ -1049,7 +1049,7 @@ arrayLast(field("tags"));
10491049
> 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.
10501050
>
10511051
1052-
Creates an expression that returns the last index of the search value in an array.
1052+
Creates an expression that returns the last index of the search value in an array. Returns -1 if the value is not found.
10531053

10541054
<b>Signature:</b>
10551055

@@ -4534,7 +4534,7 @@ export declare function arrayMinimumN(fieldName: string, n: Expression): Functio
45344534
45354535
| Parameter | Type | Description |
45364536
| --- | --- | --- |
4537-
| fieldName | string | |
4537+
| fieldName | string | The name of the field containing the array. |
45384538
| n | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the number of elements to return. |
45394539
45404540
<b>Returns:</b>

packages/firestore/src/lite-api/expressions.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
15391539

15401540
/**
15411541
* @beta
1542-
* Returns the first index of the search value in the array, or null if not found.
1542+
* Returns the first index of the search value in the array, or -1 if not found.
15431543
*
15441544
* @example
15451545
* ```typescript
@@ -1554,7 +1554,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
15541554

15551555
/**
15561556
* @beta
1557-
* Returns the first index of the search value in the array, or null if not found.
1557+
* Returns the first index of the search value in the array, or -1 if not found.
15581558
*
15591559
* @example
15601560
* ```typescript
@@ -1576,7 +1576,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
15761576

15771577
/**
15781578
* @beta
1579-
* Returns the last index of the search value in the array, or null if not found.
1579+
* Returns the last index of the search value in the array, or -1 if not found.
1580+
*
1581+
* @example
1582+
* ```typescript
1583+
* // Get the last index of the value 3 in the 'myArray' field.
1584+
* field("myArray").arrayLastIndexOf(3);
1585+
* ```
15801586
*
15811587
* @param search - The value to search for.
15821588
* @returns A new {@link @firebase/firestore/pipelines#Expression} representing the index.
@@ -1585,7 +1591,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData {
15851591

15861592
/**
15871593
* @beta
1588-
* Returns the last index of the search value in the array, or null if not found.
1594+
* Returns the last index of the search value in the array, or -1 if not found.
15891595
*
15901596
* @example
15911597
* ```typescript
@@ -6805,7 +6811,7 @@ export function arrayMinimumN(fieldName: string, n: number): FunctionExpression;
68056811
* arrayMinimumN(field("scores"), field("count"));
68066812
* ```
68076813
*
6808-
* @param arrayExpression - The name of the field containing the array.
6814+
* @param fieldName - The name of the field containing the array.
68096815
* @param n - The expression representing the number of elements to return.
68106816
* @returns A new {@link @firebase/firestore/pipelines#Expression} representing the smallest `n` elements.
68116817
*/
@@ -6987,6 +6993,7 @@ export function arrayLastIndexOf(
69876993
* @beta
69886994
*
69896995
* Creates an expression that returns the last index of the search value in an array.
6996+
* Returns -1 if the value is not found.
69906997
*
69916998
* @example
69926999
* ```typescript

0 commit comments

Comments
 (0)