@@ -78,6 +78,7 @@ export declare abstract class Expression
7878| [byteLength ()](./firestore_lite_pipelines .expression .md #expressionbytelength ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that calculates the length of this string expression in bytes . |
7979| [ceil ()](./firestore_lite_pipelines .expression .md #expressionceil ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that computes the ceiling of a numeric value . |
8080| [charLength ()](./firestore_lite_pipelines .expression .md #expressioncharlength ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that calculates the character length of a string in UTF -8. |
81+ | [coalesce (replacement , others )](./firestore_lite_pipelines .expression .md #expressioncoalesce ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that returns the first non -null , non -absent argument , without evaluating the rest of the arguments . When all arguments are null or absent , returns the last argument . |
8182| [collectionId ()](./firestore_lite_pipelines .expression .md #expressioncollectionid ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that returns the collection ID from a path . |
8283| [concat (second , others )](./firestore_lite_pipelines .expression .md #expressionconcat ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that concatenates expression results together . |
8384| [cosineDistance (vectorExpression )](./firestore_lite_pipelines .expression .md #expressioncosinedistance ) | | <b ><i >(Public Preview )</i ></b > Calculates the cosine distance between two vectors . |
@@ -110,6 +111,8 @@ export declare abstract class Expression
110111| [ifAbsent (elseExpression )](./firestore_lite_pipelines .expression .md #expressionifabsent ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that returns the <code >elseValue </code > argument if this expression results in an absent value , else return the result of this expression evaluation . |
111112| [ifError (catchExpr )](./firestore_lite_pipelines .expression .md #expressioniferror ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that returns the result of the <code >catchExpr </code > argument if there is an error , else return the result of this expression . |
112113| [ifError (catchValue )](./firestore_lite_pipelines .expression .md #expressioniferror ) | | <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 . |
114+ | [ifNull (elseExpression )](./firestore_lite_pipelines .expression .md #expressionifnull ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that returns the <code >elseValue </code > argument if this expression evaluates to null , else return the result of this expression evaluation . |
115+ | [ifNull (elseValue )](./firestore_lite_pipelines .expression .md #expressionifnull ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that returns the <code >elseValue </code > argument if this expression evaluates to null , else return the result of this expression evaluation . |
113116| [isAbsent ()](./firestore_lite_pipelines .expression .md #expressionisabsent ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that returns <code >true </code > if the result of this expression is absent . Otherwise , returns <code >false </code > even if the value is <code >null </code >. |
114117| [isError ()](./firestore_lite_pipelines .expression .md #expressioniserror ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that checks if a given expression produces an error . |
115118| [isType (type )](./firestore_lite_pipelines .expression .md #expressionistype ) | | <b ><i >(Public Preview )</i ></b > Creates an expression that checks if the result of this expression is of the given type . |
@@ -1506,6 +1509,42 @@ field("name").charLength();
15061509
15071510` ` `
15081511
1512+ ## Expression .coalesce ()
1513+
1514+ > 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 .
1515+ >
1516+
1517+ Creates an expression that returns the first non - null , non - absent argument , without evaluating the rest of the arguments . When all arguments are null or absent , returns the last argument .
1518+
1519+ <b >Signature :</b >
1520+
1521+ ` ` ` typescript
1522+ coalesce(replacement: Expression | unknown, ...others: Array<Expression | unknown>): FunctionExpression;
1523+ ` ` `
1524+
1525+ #### Parameters
1526+
1527+ | Parameter | Type | Description |
1528+ | -- - | -- - | -- - |
1529+ | replacement | [Expression ](./ firestore_lite_pipelines .expression .md #expression_class ) \| unknown | The value to use if this expression evaluates to null . |
1530+ | others | Array & lt ;[Expression ](./ firestore_lite_pipelines .expression .md #expression_class ) \| unknown & gt ; | Optional additional values to check if previous values are null . |
1531+
1532+ <b >Returns :</b >
1533+
1534+ [FunctionExpression ](./ firestore_lite_pipelines .functionexpression .md #functionexpression_class )
1535+
1536+ A new ` Expression ` representing the coalesce operation .
1537+
1538+ ### Example
1539+
1540+
1541+ ` ` ` typescript
1542+ // Returns the value of the first non-null, non-absent field among 'preferredName', 'fullName',
1543+ // or the last argument if all previous fields are null.
1544+ field("preferredName").coalesce(field("fullName"), "Anonymous");
1545+
1546+ ` ` `
1547+
15091548## Expression .collectionId ()
15101549
15111550> 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 .
@@ -2537,6 +2576,78 @@ field("title").arrayGet(0).ifError("Default Title");
25372576
25382577` ` `
25392578
2579+ ## Expression .ifNull ()
2580+
2581+ > 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 .
2582+ >
2583+
2584+ Creates an expression that returns the ` elseValue ` argument if this expression evaluates to null , else return the result of this expression evaluation .
2585+
2586+ This function provides a fallback for both absent and explicit null values. In contrast, `ifAbsent()` only triggers for missing fields.
2587+
2588+ <b >Signature:</b >
2589+
2590+ ```typescript
2591+ ifNull(elseExpression : Expression ): FunctionExpression ;
2592+ ` ` `
2593+
2594+ #### Parameters
2595+
2596+ | Parameter | Type | Description |
2597+ | --- | --- | --- |
2598+ | elseExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The Expression that will be evaluated if this Expression evaluates to null. |
2599+
2600+ <b>Returns:</b>
2601+
2602+ [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
2603+
2604+ A new ` Expression ` representing the ifNull operation.
2605+
2606+ ### Example
2607+
2608+
2609+ ` ` ` typescript
2610+ // Returns the user's preferred name, or if that is null, returns their full name.
2611+ field (" preferredName" ).ifNull (field (" fullName" ))
2612+
2613+ ` ` `
2614+
2615+ ## Expression.ifNull()
2616+
2617+ > 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.
2618+ >
2619+
2620+ Creates an expression that returns the ` elseValue ` argument if this expression evaluates to null, else return the result of this expression evaluation.
2621+
2622+ This function provides a fallback for both absent and explicit null values. In contrast, ` ifAbsent ()` only triggers for missing fields.
2623+
2624+ <b>Signature:</b>
2625+
2626+ ` ` ` typescript
2627+ ifNull (elseValue : unknown ): FunctionExpression ;
2628+ ` ` `
2629+
2630+ #### Parameters
2631+
2632+ | Parameter | Type | Description |
2633+ | --- | --- | --- |
2634+ | elseValue | unknown | The value that will be returned if this Expression evaluates to null. |
2635+
2636+ <b>Returns:</b>
2637+
2638+ [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class)
2639+
2640+ A new ` Expression ` representing the ifNull operation.
2641+
2642+ ### Example
2643+
2644+
2645+ ` ` ` typescript
2646+ // Returns the user's display name, or returns "Anonymous" if the field is null.
2647+ field (" displayName" ).ifNull (" Anonymous" )
2648+
2649+ ` ` `
2650+
25402651## Expression.isAbsent()
25412652
25422653> 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.
0 commit comments