Actually opposite of the answers $sample might not be fastest solution.
Because mongo may do a collection scan for random sorting when using $sample depending on the situation. Please see: Reference: https://docs.mongodb.com/manual/reference/operator/aggregation/sample/
Maybe doing counting result set and doing some random skip take will do better.