-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
-
-
Query 2019-11-04
The SortKeyGenerator::extractKeyPart() function gets a "randVal" from the Document metadata (by way of Expression::evaluate()) when the key pattern has {$meta: ""randVal"}. However, nowhere in the code base ever sets a random value for this piece of metadata, so the return value is always eoo. The sort deals with this lack of randomness by returning the documents in their natural order.
I discovered this problem when I attempted to add an invariant after this line to ensure that:
invariant(!plainKey.missing());
Currently, this invariant always fails, but when we figure out a way to ensure that documents have "randVal" metadata, we should be able to add that invariant in.
- is related to
-
SERVER-30405 add expression to generate a random number
- Closed