Skip to content

Commit 6f0bba9

Browse files
committed
add query explain
1 parent 0cd7a2e commit 6f0bba9

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

firestore-temp/test.firestore.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ describe("firestore-pipelines", () => {
3636
});
3737
});
3838

39+
async function queryExplainExample() {
40+
// [START query_explain]
41+
const q = db.collection("cities").where("country", "==", "USA");
42+
const options = { analyze: false };
43+
44+
const explainResults = await q.explain(options);
45+
46+
const metrics = explainResults.metrics;
47+
const plan = metrics.planSummary;
48+
// [END query_explain]
49+
}
50+
3951
async function stagesExpressionsExample() {
4052
// [START stages_expressions_example]
4153
const trailing30Days = constant(Timestamp.now().toMillis())
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 query_explain_modular]
8+
const q = db.collection("cities").where("country", "==", "USA");
9+
const options = { analyze: false };
10+
11+
const explainResults = await q.explain(options);
12+
13+
const metrics = explainResults.metrics;
14+
const plan = metrics.planSummary;
15+
// [END query_explain_modular]

0 commit comments

Comments
 (0)