#Select random documents from a collection

2 messages · Page 1 of 1 (latest)

regal birch
#

Hi , I'm wondering if it's possible to select n random documents from a collection, rather than fetching all documents and choosing random items on the payload side.

Second, Each document has a category. is it possible to select n random documents in each category in a single request? e.g. if there are 5 categories and n = 3, I'd get 15 documents, 3 in each of the 5 categories?

Thanks

elfin zincBOT