summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/queryStats/query_stats_explain_cmd_agg.js
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /jstests/noPassthrough/queryStats/query_stats_explain_cmd_agg.js
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'jstests/noPassthrough/queryStats/query_stats_explain_cmd_agg.js')
-rw-r--r--jstests/noPassthrough/queryStats/query_stats_explain_cmd_agg.js37
1 files changed, 0 insertions, 37 deletions
diff --git a/jstests/noPassthrough/queryStats/query_stats_explain_cmd_agg.js b/jstests/noPassthrough/queryStats/query_stats_explain_cmd_agg.js
deleted file mode 100644
index 2a12b85f274..00000000000
--- a/jstests/noPassthrough/queryStats/query_stats_explain_cmd_agg.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * This test confirms that the correct verbosity levels are stored in the query stats key for
- * explain commands on an agg query.
- * @tags: [requires_fcv_60]
- */
-load("jstests/libs/query_stats_utils.js");
-
-const testColl = jsTestName();
-
-const testPipeline = [{"$match": {"bar": {"$gte": 1}}}, {"$count": "bars"}];
-
-function assertVerbosityField(coll, pipeline, verbosity) {
- assert.commandWorked(coll.explain(verbosity).aggregate(pipeline));
- const entry = getLatestQueryStatsEntry(coll.getDB().getMongo(), {collName: coll.getName()});
- assert.eq(getValueAtPath(entry, "key.explain"), verbosity, tojson(entry));
- assert.eq(getValueAtPath(entry, "metrics.execCount"), 1, tojson(entry));
- // TODO SERVER-89439: Uncomment this block and perhaps add more assertions.
- // if (!FixtureHelpers.isSharded(coll)) {
- // TODO SERVER-89053: Remove conditional statement to assert in sharded tests.
- // assert.gt(getValueAtPath(entry, "metrics.lastExecutionMicros"), 1, tojson(entry));
- // }
-}
-
-withQueryStatsEnabled(testColl, (coll) => {
- // Insert documents to ensure we raise 'execCount'.
- const bulk = coll.initializeUnorderedBulkOp();
- const numDocs = 100;
- for (let i = 0; i < numDocs / 2; ++i) {
- bulk.insert({foo: 0, bar: Math.floor(Math.random() * 3)});
- bulk.insert({foo: 1, bar: Math.floor(Math.random() * -2)});
- }
- assert.commandWorked(bulk.execute());
-
- assertVerbosityField(coll, testPipeline, 'queryPlanner');
- assertVerbosityField(coll, testPipeline, 'allPlansExecution');
- assertVerbosityField(coll, testPipeline, 'executionStats');
-});