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

Add an option to the $sample stage to specify weights to use in the sampling.

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • 3.2.0
    • None
    • Aggregation Framework
    • Query Optimization
    • Fully Compatible

    Description

      Specifying this option would prevent any optimized random cursor implementation from the storage engine, and would always use a top-k random sort, with the random value used to sort being multiplied by the specified weight.

      For example:

      db.example.aggregate([{
          $sample: {
              size: 100,
              weight: "$myWeightField"
          }
      }]);
      

      Attachments

        Issue Links

          Activity

            People

              backlog-query-optimization Backlog - Query Optimization
              m3t4lukas Lukas Wagner
              Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated: