I want to create a Schema.statics.random function that gets me a random element from the collection. I know there is an example for the native MongoDB driver, b
A shorter and maybe more performant solution
(we don't iterate through the collection once to count and a second time to skip elements, but mongoose might do that behind the scenes):