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

Allow seed to be specified during $sample.

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.1
    • Component/s: Aggregation Framework
    • Query Optimization

      There are several tickets currently open relating to statistical bias (SERVER-22068) and incorrect seeding (SERVER-22069). This request relates to the ability to explicitly pass in a PRNG seed as part of the $sample pipeline.

      There are a number of situations that come immediately to mind where the ability to explicitly specify a seed would be beneficial. The first, that I mentioned via IRC, is that of an e-commerce system showing "random featured products" which rotate daily. Using the current Julian calendar date as the seed would naturally rotate daily and allow for both historical and future/predictive result generation. This is similar to the pattern games such as Minecraft use to allow specifying a seed for algorithmic world generation.

      The syntax would become:

          { $sample: { size: <positive integer>, seed: <integer> } }
      

      The seed, if omitted, could be PRNG generated itself.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            alice@gothcandy.com Dissatisfied Former User
            Votes:
            1 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: