Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66606

Full statistics pipeline

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • 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.

            Assignee:
            alya.berciu@mongodb.com Alya Berciu
            Reporter:
            joel.redman@mongodb.com Joel Redman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: