-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
QO 2022-06-27, QO 2022-07-11, QO 2022-07-25, QO 2022-08-08, QO 2022-08-22, QO 2022-09-05, QO 2022-09-19, QO 2022-10-03, QE 2022-10-17, QE 2022-10-31, QE 2022-11-14
Generate an internal command for statistics analysis which runs the following pipeline (assuming path "a.b.c"):
db.coll.aggregate( [ { $project: {val : path, hasMissing : { $cond: [{ $isArray : path }, {$anyElementTrue : { $map: {input:"$a.b", in: {$eq: [{$type: "$$this.c"{color}}, "missing"]}}}}, {$eq: [{$type: path}, "missing"]} ]} }}, { $addFields: {isArray : {$isArray : "$val"}}}, { $unwind: {path: "$val", preserveNullAndEmptyArrays : true}}, { $sort : {val : 1}}, { $_analyzeInternal: {} } ]);
Note the oddity with the prefix path is only necessary if such a prefix exists so there will need to be some logic around this. The idea here is that we want to project the path, noting whether there were any subdocuments within arrays that had missing elements. We then add a field to tell us whether the values are contained in an array, then unwind and sort, preserving null, missing, and empty arrays.
$_analyzeInternal will be implemented in another ticket. If the integration timing works our poorly, this can either be removed or replaced with something that would generate an empty document.
- depends on
-
SERVER-69782 In CQF we erroneously match documents
- Closed
-
SERVER-67506 [CQF] Dotted path equality to null incorrectly matches non-object array elements
- Closed
- is duplicated by
-
SERVER-71303 Estimate nested arrays in max_diff code
- Closed