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

$sample doesn't support variables or expression operators

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 4.2.2
    • Component/s: Aggregation Framework
    • Labels:
    • Query Optimization

      The current $sample stage only accept a number type for the size parameter, per: https://github.com/mongodb/mongo/blob/master/src/mongo/db/pipeline/document_source_sample.cpp#L102

      It would be nice to allow variables/expressions in the same way that they are almost universally available within aggregation.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            luke.prochazka@mongodb.com Luke Prochazka
            Votes:
            3 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: