-
Type: Improvement
-
Resolution: Unresolved
-
Priority: 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.