Is MongoDB capable of funding number of random documents without making multiple queries?
e.g. I implemented on the JS side after loading all the document in the col
skip didn't work out for me. Here is what I wound up with:
var randomDoc = db.getCollection("collectionName").aggregate([ { $match : { // criteria to filter matches } }, { $sample : { size : 1 } } ]).result[0];
gets a single random result, matching the criteria.