I'm using MongoDB's linq driver to get my results from the database
mymongocollection.AsQueryable().Where(x => x.Type == 1);
Now I'd like to return 20 random records from the above. I've been searching but I can't find a proper way to do this with LINQ. I prefer not to do it in memory, but on the database. I found you can use MongoDB's
$sample aggregation, but I don't know how to translate this into LINQ (if it's even possible).