mongodb-explain-compat 2.3.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +4 -16
  2. package/package.json +13 -10
package/lib/index.js CHANGED
@@ -51,17 +51,15 @@ function mapStages(queryPlan, sbeExecutionStages) {
51
51
  }
52
52
 
53
53
  // Do the actual mapping here. Use the head SBE node, and only aggregate
54
- // 'docsExamined' and 'executionTimeMillisEstimate' based on all sub-nodes
55
- // here.
56
- const initialResult = mapPlanTree(queryPlan, stage => {
54
+ // 'docsExamined' based on all child nodes and 'executionTimeMillisEstimate'
55
+ // based on all top-level child nodes here.
56
+ return mapPlanTree(queryPlan, stage => {
57
57
  const sbeNodes = stage[kSBENodes];
58
58
  const headSBENode = sbeNodes[0] || {};
59
59
  return {
60
60
  ...omitChildStages(headSBENode),
61
61
  ...omitChildStages(stage),
62
- executionTimeMillisEstimate: sbeNodes
63
- .map(sbe => sbe.executionTimeMillis || sbe.executionTimeMillisEstimate)
64
- .reduce((a, b) => a + b, 0),
62
+ executionTimeMillisEstimate: headSBENode.executionTimeMillis || headSBENode.executionTimeMillisEstimate,
65
63
  docsExamined: sbeNodes
66
64
  .filter(sbe => sbe.stage === 'seek' || sbe.stage === 'scan')
67
65
  .map(sbe => sbe.numReads || 0)
@@ -72,16 +70,6 @@ function mapStages(queryPlan, sbeExecutionStages) {
72
70
  .reduce((a, b) => a + b, 0)
73
71
  };
74
72
  });
75
-
76
- // Add the execution time stats to all parent stages.
77
- return mapPlanTree(initialResult, stage => {
78
- let time = 0;
79
- mapPlanTree(stage, child => { time += child.executionTimeMillisEstimate; });
80
- return {
81
- ...omitChildStages(stage),
82
- executionTimeMillisEstimate: time
83
- };
84
- });
85
73
  }
86
74
 
87
75
  module.exports = function(explain) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb-explain-compat",
3
- "version": "2.3.0",
3
+ "version": "2.6.0",
4
4
  "description": "Convert mongodb SBE explain output to 4.4 explain output",
5
5
  "keywords": [
6
6
  "mongodb",
@@ -9,6 +9,7 @@
9
9
  ],
10
10
  "main": "lib/index.js",
11
11
  "exports": {
12
+ "webpack": "./lib/index.js",
12
13
  "require": "./lib/index.js",
13
14
  "import": "./.esm-wrapper.mjs"
14
15
  },
@@ -21,23 +22,25 @@
21
22
  ],
22
23
  "scripts": {
23
24
  "lint": "eslint **/*.js",
24
- "test": "npm run lint && npm run build && nyc mocha --colors test/*.js",
25
- "build": "gen-esm-wrapper . ./.esm-wrapper.mjs",
26
- "prepare": "npm run build",
25
+ "test": "npm run lint && npm run compile && nyc mocha --colors test/*.js",
26
+ "compile": "gen-esm-wrapper . ./.esm-wrapper.mjs",
27
+ "prepublishOnly": "npm run compile",
27
28
  "test-ci": "npm run test",
28
- "depcheck": "depcheck"
29
+ "depcheck": "depcheck",
30
+ "bootstrap": "npm run compile"
29
31
  },
30
- "homepage": "https://github.com/mongodb-js/mongodb-explain-compat",
32
+ "homepage": "https://github.com/mongodb-js/compass",
31
33
  "repository": {
32
34
  "type": "git",
33
- "url": "https://github.com/mongodb-js/mongodb-explain-compat.git"
35
+ "url": "https://github.com/mongodb-js/compass.git"
34
36
  },
35
37
  "bugs": {
36
- "url": "https://github.com/mongodb-js/mongodb-explain-compat/issues"
38
+ "url": "https://jira.mongodb.org/projects/COMPASS/issues",
39
+ "email": "compass@mongodb.com"
37
40
  },
38
41
  "license": "SSPL",
39
42
  "devDependencies": {
40
- "eslint": "^7.9.0",
43
+ "eslint": "^7.25.0",
41
44
  "eslint-config-semistandard": "^15.0.1",
42
45
  "eslint-config-standard": "^14.1.1",
43
46
  "eslint-plugin-import": "^2.22.0",
@@ -48,5 +51,5 @@
48
51
  "mocha": "^8.1.3",
49
52
  "nyc": "^15.1.0"
50
53
  },
51
- "gitHead": "0819b7be289d05d770a45071692cb772806e61f0"
54
+ "gitHead": "77166e3754e36e95c7ff7efb5a0ce5e0990b0ff7"
52
55
  }