Skip to content

Commit e77481c

Browse files
committed
docs devsite update
1 parent 9bb0f6c commit e77481c

7 files changed

Lines changed: 64 additions & 66 deletions

docs-devsite/firestore_lite_pipelines.booleanexpression.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
127127
```typescript
128128
// Create an expression that protects against a divide by zero error
129129
// but always returns a boolean expression.
130-
constant(50).divide('length').gt(1).ifError(constant(false));
130+
constant(50).divide(field('length')).greaterThan(1).ifError(constant(false));
131131

132132
```
133133
@@ -162,7 +162,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
162162
```typescript
163163
// Create an expression that protects against a divide by zero error
164164
// but always returns a boolean expression.
165-
constant(50).divide('length').gt(1).ifError(false);
165+
constant(50).divide(field('length')).greaterThan(1).ifError(false);
166166

167167
```
168168
@@ -196,7 +196,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
196196
197197
```typescript
198198
// Create an expression that protects against a divide by zero error.
199-
constant(50).divide('length').gt(1).ifError(constant(0));
199+
constant(50).divide(field('length')).greaterThan(1).ifError(constant(0));
200200

201201
```
202202
@@ -230,7 +230,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
230230
231231
```typescript
232232
// Create an expression that protects against a divide by zero error.
233-
constant(50).divide('length').gt(1).ifError(0);
233+
constant(50).divide(field('length')).greaterThan(1).ifError(0);
234234

235235
```
236236

docs-devsite/firestore_lite_pipelines.expression.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ A new `Ordering` for ascending sorting.
13891389

13901390
```typescript
13911391
// Sort documents by the 'name' field in ascending order
1392-
pipeline().collection("users")
1392+
firestore.pipeline().collection("users")
13931393
.sort(field("name").ascending());
13941394
13951395
```
@@ -2043,7 +2043,7 @@ A new `Expression` representing the 'IN' comparison.
20432043

20442044
```typescript
20452045
// Check if the 'category' field is either "Electronics" or value of field 'primaryType'
2046-
field("category").equalAny("Electronics", field("primaryType"));
2046+
field("category").equalAny(["Electronics", field("primaryType")]);
20472047
20482048
```
20492049

@@ -2557,7 +2557,6 @@ A new [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpr
25572557
```typescript
25582558
// Check if the field `value` is absent.
25592559
field("value").isAbsent();
2560-
@example
25612560
25622561
```
25632562

@@ -3038,7 +3037,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
30383037

30393038
```typescript
30403039
// Returns the larger value between the 'timestamp' field and the current timestamp.
3041-
field("timestamp").logicalMaximum(Function.currentTimestamp());
3040+
field("timestamp").logicalMaximum(currentTimestamp());
30423041
30433042
```
30443043

@@ -3073,7 +3072,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
30733072

30743073
```typescript
30753074
// Returns the smaller value between the 'timestamp' field and the current timestamp.
3076-
field("timestamp").logicalMinimum(Function.currentTimestamp());
3075+
field("timestamp").logicalMinimum(currentTimestamp());
30773076
30783077
```
30793078

@@ -4239,7 +4238,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
42394238

42404239
```typescript
42414240
// Split the 'scores' field on delimiter ',' or ':' depending on the stored format
4242-
field('scores').split(conditional(field('format').equal('csv'), constant(','), constant(':'))
4241+
field('scores').split(conditional(field('format').equal('csv'), constant(','), constant(':')))
42434242
42444243
```
42454244

docs-devsite/firestore_lite_pipelines.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
20242024

20252025
```typescript
20262026
// Create an array value from the input array and reference the 'baz' field value from the input document.
2027-
array(['bar', Field.of('baz')]).as('foo');
2027+
array(['bar', field('baz')]).as('foo');
20282028

20292029
```
20302030

@@ -2058,7 +2058,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
20582058

20592059
```typescript
20602060
// Create a map from the input object and reference the 'baz' field value from the input document.
2061-
map({foo: 'bar', baz: Field.of('baz')}).as('data');
2061+
map({foo: 'bar', baz: field('baz')}).as('data');
20622062

20632063
```
20642064

@@ -3634,7 +3634,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
36343634

36353635
```typescript
36363636
// Split the 'scores' field on delimiter ',' or ':' depending on the stored format
3637-
split(field('scores'), conditional(field('format').equal('csv'), constant(','), constant(':'))
3637+
split(field('scores'), conditional(field('format').equal('csv'), constant(','), constant(':')))
36383638

36393639
```
36403640

@@ -4086,7 +4086,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
40864086

40874087
```typescript
40884088
// Reverse the value of the 'myString' field.
4089-
strReverse("myString");
4089+
stringReverse("myString");
40904090

40914091
```
40924092

@@ -5250,7 +5250,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
52505250

52515251
```typescript
52525252
// Get the character length of the 'name' field in UTF-8.
5253-
strLength("name");
5253+
charLength("name");
52545254

52555255
```
52565256

@@ -7527,7 +7527,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
75277527

75287528
```typescript
75297529
// Split the 'scores' field on delimiter ',' or ':' depending on the stored format
7530-
split('scores', conditional(field('format').equal('csv'), constant(','), constant(':'))
7530+
split('scores', conditional(field('format').equal('csv'), constant(','), constant(':')))
75317531

75327532
```
75337533

@@ -9330,7 +9330,7 @@ A new `Expression` representing the greater than comparison.
93309330

93319331
```typescript
93329332
// Check if the 'age' field is greater than 18
9333-
greaterThan(field("age"), Constant(9).add(9));
9333+
greaterThan(field("age"), constant(9).add(9));
93349334

93359335
```
93369336

@@ -10193,7 +10193,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
1019310193

1019410194
```typescript
1019510195
// Get the character length of the 'name' field in UTF-8.
10196-
strLength(field("name"));
10196+
charLength(field("name"));
1019710197

1019810198
```
1019910199

@@ -10829,7 +10829,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
1082910829

1083010830
```typescript
1083110831
// Reverse the value of the 'myString' field.
10832-
strReverse(field("myString"));
10832+
stringReverse(field("myString"));
1083310833

1083410834
```
1083510835

@@ -10897,7 +10897,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
1089710897

1089810898
```typescript
1089910899
// Convert the 'title' field to uppercase
10900-
toUppercase(field("title"));
10900+
toUpper(field("title"));
1090110901

1090210902
```
1090310903

@@ -11195,7 +11195,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
1119511195
```typescript
1119611196
// Create an expression that protects against a divide by zero error
1119711197
// but always returns a boolean expression.
11198-
ifError(constant(50).divide('length').gt(1), constant(false));
11198+
ifError(constant(50).divide(field('length')).greaterThan(1), constant(false));
1119911199

1120011200
```
1120111201

docs-devsite/firestore_lite_pipelines.pipeline.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ A new Pipeline object with this stage appended to the stage list.
120120
firestore.pipeline().collection("books")
121121
.addFields(
122122
field("rating").as("bookRating"), // Rename 'rating' to 'bookRating'
123-
add(5, field("quantity")).as("totalCost") // Calculate 'totalCost'
123+
add(field("quantity"), 5).as("totalCost") // Calculate 'totalCost'
124124
);
125125

126126
```
@@ -165,7 +165,7 @@ A new Pipeline object with this stage appended to the stage list.
165165
firestore.pipeline().collection("books")
166166
.addFields(
167167
field("rating").as("bookRating"), // Rename 'rating' to 'bookRating'
168-
add(5, field("quantity")).as("totalCost") // Calculate 'totalCost'
168+
add(field("quantity"), 5).as("totalCost") // Calculate 'totalCost'
169169
);
170170

171171
```
@@ -207,7 +207,7 @@ A new Pipeline object with this stage appended to the stage list.
207207
// Calculate the average rating and the total number of books
208208
firestore.pipeline().collection("books")
209209
.aggregate(
210-
field("rating").avg().as("averageRating"),
210+
field("rating").average().as("averageRating"),
211211
countAll().as("totalBooks")
212212
);
213213

@@ -251,7 +251,7 @@ A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with t
251251
// Calculate the average rating for each genre.
252252
firestore.pipeline().collection("books")
253253
.aggregate({
254-
accumulators: [avg(field("rating")).as("avg_rating")]
254+
accumulators: [average(field("rating")).as("avg_rating")],
255255
groups: ["genre"]
256256
});
257257

@@ -297,7 +297,7 @@ A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with t
297297
```typescript
298298
// Get a list of unique author names in uppercase and genre combinations.
299299
firestore.pipeline().collection("books")
300-
.distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt")
300+
.distinct(toUpper(field("author")).as("authorName"), field("genre"), "publishedAt")
301301
.select("authorName");
302302

303303
```
@@ -341,7 +341,7 @@ A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with t
341341
```typescript
342342
// Get a list of unique author names in uppercase and genre combinations.
343343
firestore.pipeline().collection("books")
344-
.distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt")
344+
.distinct(toUpper(field("author")).as("authorName"), field("genre"), "publishedAt")
345345
.select("authorName");
346346

347347
```
@@ -594,7 +594,7 @@ A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with t
594594
```typescript
595595
// Assume we don't have a built-in 'where' stage
596596
firestore.pipeline().collection('books')
597-
.rawStage('where', [field('published').lt(1900)]) // Custom 'where' stage
597+
.rawStage('where', [field('published').lessThan(1900)]) // Custom 'where' stage
598598
.select('title', 'author');
599599

600600
```
@@ -971,7 +971,7 @@ db.pipeline().collection("books")
971971
.select(
972972
"firstName",
973973
field("lastName"),
974-
field("address").toUppercase().as("upperAddress"),
974+
field("address").toUpper().as("upperAddress"),
975975
);
976976

977977
```
@@ -1017,7 +1017,7 @@ db.pipeline().collection("books")
10171017
.select(
10181018
"firstName",
10191019
field("lastName"),
1020-
field("address").toUppercase().as("upperAddress"),
1020+
field("address").toUpper().as("upperAddress"),
10211021
);
10221022

10231023
```
@@ -1060,8 +1060,8 @@ A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with t
10601060
// with the same rating
10611061
firestore.pipeline().collection("books")
10621062
.sort(
1063-
Ordering.of(field("rating")).descending(),
1064-
Ordering.of(field("title")) // Ascending order is the default
1063+
field("rating").descending(),
1064+
field("title").ascending()
10651065
);
10661066

10671067
```
@@ -1103,8 +1103,8 @@ A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with t
11031103
// with the same rating
11041104
firestore.pipeline().collection("books")
11051105
.sort(
1106-
Ordering.of(field("rating")).descending(),
1107-
Ordering.of(field("title")) // Ascending order is the default
1106+
field("rating").descending(),
1107+
field("title").ascending()
11081108
);
11091109

11101110
```
@@ -1328,8 +1328,8 @@ A new Pipeline object with this stage appended to the stage list.
13281328
firestore.pipeline().collection("books")
13291329
.where(
13301330
and(
1331-
gt(field("rating"), 4.0), // Filter for ratings greater than 4.0
1332-
field("genre").eq("Science Fiction") // Equivalent to gt("genre", "Science Fiction")
1331+
greaterThan(field("rating"), 4.0), // Filter for ratings greater than 4.0
1332+
field("genre").equal("Science Fiction") // Equivalent to equal("genre", "Science Fiction")
13331333
)
13341334
);
13351335

@@ -1373,8 +1373,8 @@ A new Pipeline object with this stage appended to the stage list.
13731373
firestore.pipeline().collection("books")
13741374
.where(
13751375
and(
1376-
gt(field("rating"), 4.0), // Filter for ratings greater than 4.0
1377-
field("genre").eq("Science Fiction") // Equivalent to gt("genre", "Science Fiction")
1376+
greaterThan(field("rating"), 4.0), // Filter for ratings greater than 4.0
1377+
field("genre").equal("Science Fiction") // Equivalent to equal("genre", "Science Fiction")
13781378
)
13791379
);
13801380

@@ -1394,13 +1394,13 @@ const results1 = await execute(db.pipeline()
13941394
// Example 2: Filter documents where 'genre' is "Science Fiction" and 'published' is after 1950
13951395
const results2 = await execute(db.pipeline()
13961396
.collection("books")
1397-
.where(and(field("genre").eq("Science Fiction"), field("published").gt(1950))));
1397+
.where(and(field("genre").equal("Science Fiction"), field("published").greaterThan(1950))));
13981398

13991399
// Example 3: Calculate the average rating of books published after 1980
14001400
const results3 = await execute(db.pipeline()
14011401
.collection("books")
1402-
.where(field("published").gt(1980))
1403-
.aggregate(avg(field("rating")).as("averageRating")));
1402+
.where(field("published").greaterThan(1980))
1403+
.aggregate(average(field("rating")).as("averageRating")));
14041404

14051405
```
14061406

docs-devsite/firestore_pipelines.booleanexpression.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
127127
```typescript
128128
// Create an expression that protects against a divide by zero error
129129
// but always returns a boolean expression.
130-
constant(50).divide('length').gt(1).ifError(constant(false));
130+
constant(50).divide(field('length')).greaterThan(1).ifError(constant(false));
131131

132132
```
133133
@@ -162,7 +162,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
162162
```typescript
163163
// Create an expression that protects against a divide by zero error
164164
// but always returns a boolean expression.
165-
constant(50).divide('length').gt(1).ifError(false);
165+
constant(50).divide(field('length')).greaterThan(1).ifError(false);
166166

167167
```
168168
@@ -196,7 +196,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
196196
197197
```typescript
198198
// Create an expression that protects against a divide by zero error.
199-
constant(50).divide('length').gt(1).ifError(constant(0));
199+
constant(50).divide(field('length')).greaterThan(1).ifError(constant(0));
200200

201201
```
202202
@@ -230,7 +230,7 @@ A new [Expression](./firestore_pipelines.expression.md#expression_class) represe
230230
231231
```typescript
232232
// Create an expression that protects against a divide by zero error.
233-
constant(50).divide('length').gt(1).ifError(0);
233+
constant(50).divide(field('length')).greaterThan(1).ifError(0);
234234

235235
```
236236

0 commit comments

Comments
 (0)