@@ -45,6 +45,7 @@ export declare abstract class Expression
4545| [arrayContainsAll (arrayExpression )](./firestore_lite_pipelines .expression .md #expressionarraycontainsall ) | | Creates an expression that checks if an array contains all the specified elements . |
4646| [arrayContainsAny (values )](./firestore_lite_pipelines .expression .md #expressionarraycontainsany ) | | Creates an expression that checks if an array contains any of the specified elements . |
4747| [arrayContainsAny (arrayExpression )](./firestore_lite_pipelines .expression .md #expressionarraycontainsany ) | | Creates an expression that checks if an array contains any of the specified elements . |
48+ | [arrayFilter (alias , filter )](./firestore_lite_pipelines .expression .md #expressionarrayfilter ) | | Filters the array using a provided alias and predicate expression . |
4849| [arrayFirst ()](./firestore_lite_pipelines .expression .md #expressionarrayfirst ) | | Returns the first element of the array . |
4950| [arrayFirstN (n )](./firestore_lite_pipelines .expression .md #expressionarrayfirstn ) | | Returns the first <code >n </code > elements of the array . |
5051| [arrayFirstN (n )](./firestore_lite_pipelines .expression .md #expressionarrayfirstn ) | | Returns the first <code >n </code > elements of the array . |
@@ -67,7 +68,10 @@ export declare abstract class Expression
6768| [arrayMinimumN (n )](./firestore_lite_pipelines .expression .md #expressionarrayminimumn ) | | Returns the smallest <code >n </code > elements of the array .<!-- -->Note : Returns the n smallest non -null elements in the array , in ascending order . This does not use a stable sort , meaning the order of equivalent elements is undefined . |
6869| [arrayMinimumN (n )](./firestore_lite_pipelines .expression .md #expressionarrayminimumn ) | | Returns the smallest <code >n </code > elements of the array .<!-- -->Note : Returns the n smallest non -null elements in the array , in ascending order . This does not use a stable sort , meaning the order of equivalent elements is undefined . |
6970| [arrayReverse ()](./firestore_lite_pipelines .expression .md #expressionarrayreverse ) | | Creates an expression that reverses an array . |
71+ | [arraySlice (offset , length )](./firestore_lite_pipelines .expression .md #expressionarrayslice ) | | Returns a subset of the array . |
7072| [arraySum ()](./firestore_lite_pipelines .expression .md #expressionarraysum ) | | Creates an expression that computes the sum of the elements in an array . |
73+ | [arrayTransform (elementAlias , transform )](./firestore_lite_pipelines .expression .md #expressionarraytransform ) | | Creates an expression that applies a provided transformation to each element in an array . |
74+ | [arrayTransformWithIndex (elementAlias , indexAlias , transform )](./firestore_lite_pipelines .expression .md #expressionarraytransformwithindex ) | | Creates an expression that applies a provided transformation to each element in an array , providing the element 's index to the transformation expression . |
7175| [as (name )](./firestore_lite_pipelines .expression .md #expressionas ) | | Assigns an alias to this expression .<!-- -->Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values . |
7276| [asBoolean ()](./firestore_lite_pipelines .expression .md #expressionasboolean ) | | Wraps the expression in a \[BooleanExpression \]. |
7377| [ascending ()](./firestore_lite_pipelines .expression .md #expressionascending ) | | Creates an [Ordering ](./firestore_pipelines .ordering .md #ordering_class ) that sorts documents in ascending order based on this expression . |
@@ -539,6 +543,38 @@ field("groups").arrayContainsAny(array([field("userGroup"), "guest"]));
539543
540544` ` `
541545
546+ ## Expression .arrayFilter ()
547+
548+ Filters the array using a provided alias and predicate expression .
549+
550+ <b >Signature :</b >
551+
552+ ` ` ` typescript
553+ arrayFilter(alias: string, filter: BooleanExpression): FunctionExpression;
554+ ` ` `
555+
556+ #### Parameters
557+
558+ | Parameter | Type | Description |
559+ | -- - | -- - | -- - |
560+ | alias | string | The variable name to use for each element . |
561+ | filter | [BooleanExpression ](./ firestore_lite_pipelines .booleanexpression .md #booleanexpression_class ) | The predicate boolean expression to filter by . |
562+
563+ <b >Returns :</b >
564+
565+ [FunctionExpression ](./ firestore_lite_pipelines .functionexpression .md #functionexpression_class )
566+
567+ A new ` Expression ` representing the filtered array .
568+
569+ ### Example
570+
571+
572+ ` ` ` typescript
573+ // Filter the 'items' array to only include those where the 'price' is greater than 10
574+ field("items").arrayFilter('item', greaterThan(variable('item.price'), 10));
575+
576+ ` ` `
577+
542578## Expression .arrayFirst ()
543579
544580Returns the first element of the array .
@@ -1188,6 +1224,41 @@ field("myArray").arrayReverse();
11881224
11891225` ` `
11901226
1227+ ## Expression .arraySlice ()
1228+
1229+ Returns a subset of the array .
1230+
1231+ <b >Signature :</b >
1232+
1233+ ` ` ` typescript
1234+ arraySlice(offset: number | Expression, length?: number | Expression): FunctionExpression;
1235+ ` ` `
1236+
1237+ #### Parameters
1238+
1239+ | Parameter | Type | Description |
1240+ | -- - | -- - | -- - |
1241+ | offset | number \| [Expression ](./ firestore_lite_pipelines .expression .md #expression_class ) | The starting offset . |
1242+ | length | number \| [Expression ](./ firestore_lite_pipelines .expression .md #expression_class ) | The optional length of the slice . |
1243+
1244+ <b >Returns :</b >
1245+
1246+ [FunctionExpression ](./ firestore_lite_pipelines .functionexpression .md #functionexpression_class )
1247+
1248+ A new ` Expression ` representing the sliced array .
1249+
1250+ ### Example
1251+
1252+
1253+ ` ` ` typescript
1254+ // Get 5 elements from the 'items' array starting from index 2
1255+ field("items").arraySlice(2, 5);
1256+
1257+ // Get n number of elements from the 'items' array starting from index 2
1258+ field("items").arraySlice(2, field("count"));
1259+
1260+ ` ` `
1261+
11911262## Expression .arraySum ()
11921263
11931264Creates an expression that computes the sum of the elements in an array .
@@ -1212,6 +1283,71 @@ field("scores").arraySum();
12121283
12131284` ` `
12141285
1286+ ## Expression .arrayTransform ()
1287+
1288+ Creates an expression that applies a provided transformation to each element in an array .
1289+
1290+ <b >Signature :</b >
1291+
1292+ ` ` ` typescript
1293+ arrayTransform(elementAlias: string, transform: Expression): FunctionExpression;
1294+ ` ` `
1295+
1296+ #### Parameters
1297+
1298+ | Parameter | Type | Description |
1299+ | -- - | -- - | -- - |
1300+ | elementAlias | string | The variable name to use for each element . |
1301+ | transform | [Expression ](./ firestore_lite_pipelines .expression .md #expression_class ) | The lambda expression used to transform the elements . |
1302+
1303+ <b >Returns :</b >
1304+
1305+ [FunctionExpression ](./ firestore_lite_pipelines .functionexpression .md #functionexpression_class )
1306+
1307+ A new ` Expression ` representing the arrayTransform operation .
1308+
1309+ ### Example
1310+
1311+
1312+ ` ` ` typescript
1313+ // Transform the 'scores' array by multiplying each score by 10
1314+ field("scores").arrayTransform("score", multiply(variable("score"), 10));
1315+
1316+ ` ` `
1317+
1318+ ## Expression .arrayTransformWithIndex ()
1319+
1320+ Creates an expression that applies a provided transformation to each element in an array , providing the element ' s index to the transformation expression.
1321+
1322+ <b >Signature :</b >
1323+
1324+ ` ` ` typescript
1325+ arrayTransformWithIndex(elementAlias: string, indexAlias: string, transform: Expression): FunctionExpression;
1326+ ` ` `
1327+
1328+ #### Parameters
1329+
1330+ | Parameter | Type | Description |
1331+ | -- - | -- - | -- - |
1332+ | elementAlias | string | The variable name to use for each element . |
1333+ | indexAlias | string | The variable name to use for the current index . |
1334+ | transform | [Expression ](./ firestore_lite_pipelines .expression .md #expression_class ) | The lambda expression used to transform the elements . |
1335+
1336+ <b >Returns :</b >
1337+
1338+ [FunctionExpression ](./ firestore_lite_pipelines .functionexpression .md #functionexpression_class )
1339+
1340+ A new ` Expression ` representing the arrayTransformWithIndex operation .
1341+
1342+ ### Example
1343+
1344+
1345+ ` ` ` typescript
1346+ // Transform the 'scores' array by adding the index to each score
1347+ field("scores").arrayTransformWithIndex("score", "i", add(variable("score"), variable("i")));
1348+
1349+ ` ` `
1350+
12151351## Expression .as ()
12161352
12171353Assigns an alias to this expression .
0 commit comments