You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* An enumeration of the different types generated by the Firestore backend.
36
+
*
37
+
* <ul>
38
+
* <li>Numerics evaluate directly to backend representation (`int64` or `float64`), not JS `number`.</li>
39
+
* <li>JavaScript `Date` and firestore `Timestamp` objects strictly evaluate to `'timestamp'`.</li>
40
+
* <li>Advanced configurations parsing backend types (such as `decimal128`, `max_key` or `min_key` from BSON) are also incorporated in this union string type. Note that `decimal128` is a backend-only numeric type that the JavaScript SDK cannot create natively, but can be evaluated in pipelines.</li>
41
+
* </ul>
42
+
*/
43
+
exporttypeType=
44
+
|'null'
45
+
|'array'
46
+
|'boolean'
47
+
|'bytes'
48
+
|'timestamp'
49
+
|'geo_point'
50
+
|'number'
51
+
|'int32'
52
+
|'int64'
53
+
|'float64'
54
+
|'decimal128'
55
+
|'map'
56
+
|'reference'
57
+
|'string'
58
+
|'vector'
59
+
|'max_key'
60
+
|'min_key'
61
+
|'object_id'
62
+
|'regex'
63
+
|'request_timestamp';
64
+
32
65
/**
33
66
* @beta
34
67
* Represents an expression that can be evaluated to a value within the execution of a `Pipeline`.
@@ -2497,6 +2530,28 @@ export abstract class Expression
2497
2530
returnnewFunctionExpression('type',[this]);
2498
2531
}
2499
2532
2533
+
/**
2534
+
* @beta
2535
+
* Creates an expression that checks if the result of this expression is of the given type.
2536
+
*
2537
+
* @remarks Null or undefined fields evaluate to skip/error. Use `ifAbsent()` / `isAbsent()` to evaluate missing data.
2538
+
*
2539
+
* @example
2540
+
* ```typescript
2541
+
* // Check if the 'price' field is specifically an integer (not just 'number')
2542
+
* field('price').isType('int64');
2543
+
* ```
2544
+
*
2545
+
* @param type The type to check for.
2546
+
* @returns A new `BooleanExpression` that evaluates to true if the expression's result is of the given type, false otherwise.
2547
+
*/
2548
+
isType(type: Type): BooleanExpression{
2549
+
returnnewFunctionExpression('is_type',[
2550
+
this,
2551
+
constant(type),
2552
+
]).asBoolean();
2553
+
}
2554
+
2500
2555
// TODO(new-expression): Add new expression method definitions above this line
* An enumeration of the different types generated by the Firestore backend.
10152
+
*
10153
+
* <ul>
10154
+
* <li>Numerics evaluate directly to backend representation (`int64` or `float64`), not JS `number`.</li>
10155
+
* <li>JavaScript `Date` and firestore `Timestamp` objects strictly evaluate to `'timestamp'`.</li>
10156
+
* <li>Advanced configurations parsing backend types (such as `decimal128`, `max_key` or `min_key` from BSON) are also incorporated in this union string type. Note that `decimal128` is a backend-only numeric type that the JavaScript SDK cannot create natively, but can be evaluated in pipelines.</li>
10157
+
* </ul>
10158
+
*/
10159
+
exporttypeType=
10160
+
|'null'
10161
+
|'array'
10162
+
|'boolean'
10163
+
|'bytes'
10164
+
|'timestamp'
10165
+
|'geo_point'
10166
+
|'number'
10167
+
|'int32'
10168
+
|'int64'
10169
+
|'float64'
10170
+
|'decimal128'
10171
+
|'map'
10172
+
|'reference'
10173
+
|'string'
10174
+
|'vector'
10175
+
|'max_key'
10176
+
|'min_key'
10177
+
|'object_id'
10178
+
|'regex'
10179
+
|'request_timestamp';
10180
+
10131
10181
/**
10132
10182
* @beta
10133
10183
* Creates an expression that returns the data type of the data in the specified field.
0 commit comments