Skip to content

Commit 84afb2a

Browse files
committed
run snippets
1 parent 7a28b95 commit 84afb2a

12 files changed

Lines changed: 176 additions & 0 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START define_example_modular]
8+
const result = await db.pipeline().collection("authors")
9+
.define(
10+
field("id").as("currentAuthorId")
11+
)
12+
// [END define_example_modular]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START delete_dml_modular]
8+
const pipeline = db.pipeline()
9+
.collectionGroup("users")
10+
.where(field("address.country").equal("USA"))
11+
.where(field("__create_time__").timestampAdd("day", 10).lessThan(currentTimestamp()))
12+
.delete();
13+
await pipeline.execute();
14+
// [END delete_dml_modular]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START force_index_id_modular]
8+
// Force Planner to use Index ID CICAgOi36pgK
9+
await db.pipeline()
10+
.collectionGroup({ collectionId: "customers", forceIndex: "CICAgOi36pgK" })
11+
.limit(100)
12+
.execute();
13+
// [END force_index_id_modular]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START force_index_primary_modular]
8+
// Force Planner to only do a collection scan
9+
await db.pipeline()
10+
.collectionGroup({ collectionId: "customers", forceIndex: "primary" })
11+
.limit(100)
12+
.execute();
13+
// [END force_index_primary_modular]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START search_exact_match_modular]
8+
await db.pipeline().collection('restaurants')
9+
.search({
10+
query: documentMatches('"belgian waffles"')
11+
})
12+
.execute();
13+
// [END search_exact_match_modular]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START search_example_modular]
8+
await db.pipeline().collection('restaurants')
9+
.search({
10+
query: documentMatches('waffles')
11+
})
12+
.execute();
13+
// [END search_example_modular]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START search_exclude_term_modular]
8+
await db.pipeline().collection('restaurants')
9+
.search({
10+
query: documentMatches('-waffles')
11+
})
12+
.execute();
13+
// [END search_exclude_term_modular]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START search_score_field_modular]
8+
await db.pipeline().collection('restaurants')
9+
.search({
10+
query: field('menu').matches('waffles'),
11+
addFields: [
12+
score().as('score'),
13+
]
14+
}).execute();
15+
// [END search_score_field_modular]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START search_two_terms_modular]
8+
await db.pipeline().collection('restaurants')
9+
.search({
10+
query: documentMatches('waffles eggs')
11+
})
12+
.execute();
13+
// [END search_two_terms_modular]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firestore-temp/test.firestore.js
3+
//
4+
// To update the snippets in this file, edit the source and then run
5+
// 'npm run snippets'.
6+
7+
// [START to_array_expression_modular]
8+
await db.pipeline().collection("projects")
9+
.define(
10+
field("id").as("parentId")
11+
)
12+
.addFields(
13+
db.pipeline().collection("tasks")
14+
.where(field("project_id").equal(variable("parentId")))
15+
.select(field("title"))
16+
.toArrayExpression()
17+
.as("taskTitles")
18+
)
19+
.execute();
20+
// [END to_array_expression_modular]

0 commit comments

Comments
 (0)