Skip to content

Commit f5729cb

Browse files
committed
run snippets
1 parent e67c4ea commit f5729cb

File tree

93 files changed

+341
-342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+341
-342
lines changed

snippets/firestore-next/test-firestore/add_function.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// 'npm run snippets'.
66

77
// [START add_function_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([field("soldBooks").add(field("unsoldBooks")).as("totalBooks")])
11-
.execute();
10+
.select(field("soldBooks").add(field("unsoldBooks")).as("totalBooks"))
11+
);
1212
// [END add_function_modular]

snippets/firestore-next/test-firestore/aggregate_distinct.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// 'npm run snippets'.
66

77
// [START aggregate_distinct_modular]
8-
const results = await db.pipeline()
8+
const results = await execute(db.pipeline()
99
.collection("books")
10-
.distinct([
10+
.distinct(
1111
field("author").toUpper().as("author"),
1212
field("genre")
13-
])
14-
.execute();
13+
)
14+
);
1515
// [END aggregate_distinct_modular]

snippets/firestore-next/test-firestore/aggregate_groups.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
// 'npm run snippets'.
66

77
// [START aggregate_groups_modular]
8-
const results = await db.pipeline()
8+
const results = await execute(db.pipeline()
99
.collection("books")
10-
.aggregate([
10+
.aggregate(
1111
field("rating").average().as("avg_rating")
12-
], {
13-
groups: [
14-
field("genre")
15-
]
16-
})
17-
.execute();
12+
)
13+
.distinct(field("genre"))
14+
);
1815
// [END aggregate_groups_modular]

snippets/firestore-next/test-firestore/and_function.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// 'npm run snippets'.
66

77
// [START and_function_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([
10+
.select(
1111
and(field("rating").greaterThan(4), (field("price").lessThan(10)))
1212
.as("under10Recommendation")
13-
])
14-
.execute();
13+
)
14+
);
1515
// [END and_function_modular]

snippets/firestore-next/test-firestore/array_concat.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// 'npm run snippets'.
66

77
// [START array_concat_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([field("genre").arrayConcat([field("subGenre")]).as("allGenres")])
11-
.execute();
10+
.select(field("genre").arrayConcat([field("subGenre")]).as("allGenres"))
11+
);
1212
// [END array_concat_modular]

snippets/firestore-next/test-firestore/array_contains.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// 'npm run snippets'.
66

77
// [START array_contains_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([field("genre").arrayContains(constant("mystery")).as("isMystery")])
11-
.execute();
10+
.select(field("genre").arrayContains(constant("mystery")).as("isMystery"))
11+
);
1212
// [END array_contains_modular]

snippets/firestore-next/test-firestore/array_contains_all.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
// 'npm run snippets'.
66

77
// [START array_contains_all_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([
10+
.select(
1111
field("genre")
1212
.arrayContainsAll([constant("fantasy"), constant("adventure")])
1313
.as("isFantasyAdventure")
14-
])
15-
.execute();
14+
)
15+
);
1616
// [END array_contains_all_modular]

snippets/firestore-next/test-firestore/array_contains_any.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
// 'npm run snippets'.
66

77
// [START array_contains_any_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([
10+
.select(
1111
field("genre")
1212
.arrayContainsAny([constant("fantasy"), constant("nonfiction")])
1313
.as("isMysteryOrFantasy")
14-
])
15-
.execute();
14+
)
15+
);
1616
// [END array_contains_any_modular]

snippets/firestore-next/test-firestore/array_length.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// 'npm run snippets'.
66

77
// [START array_length_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([field("genre").arrayLength().as("genreCount")])
11-
.execute();
10+
.select(field("genre").arrayLength().as("genreCount"))
11+
);
1212
// [END array_length_modular]

snippets/firestore-next/test-firestore/array_reverse.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// 'npm run snippets'.
66

77
// [START array_reverse_modular]
8-
const result = await db.pipeline()
8+
const result = await execute(db.pipeline()
99
.collection("books")
10-
.select([field("genre").arrayReverse().as("reversedGenres")])
11-
.execute();
10+
.select(field("genre").arrayReverse().as("reversedGenres"))
11+
);
1212
// [END array_reverse_modular]

0 commit comments

Comments
 (0)