Allow query results on collection endpoints to be randomized
Currently, queries on collection endpoints (such as GET /runs
or GET /stats/alignments/gentrap
) returns the last-inserted document first. This is by design from MongoDB, but we don't always want this since this means earlier runs will essentially become unused. What we want is a way to sample deposited runs randomly.
Implementation is made difficult since Mongo does not support randomization of queries (there is a ticket open for it here). There are ways to get around this on the client side, though they have their own drawbacks.