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

$percentile accumulator doesn't accept variables from the "let" option

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.0-rc5
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v7.0
    • QI 2023-06-12, QI 2023-06-26

      Run:

      db.test.aggregate([{
          $group: {_id: null, median: {$percentile: {p: ["$$foo"], method: "approximate", input: "$a"}}}
        }],
        {let: {foo: 0.5}
      })

      Result: 'MongoServerError: BSON field '$percentile.p.0' is the wrong type 'string', expected types '[long, int, decimal, double]'

      It looks like the idl validation kicks in before the expression is substituted from the "let" option.

            Assignee:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Reporter:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: