Can anyone let me know how to find the random N documents from the collection having less than N documents. I tried using $sample which is resulting the maximum size of collection.
Here is the code which I have tried.
question.aggregate([{$sample: {size: 12}}]);
question collection is having 10 records but I'm trying for the outcome of 12. When I tried as above, the result is having only 10 documents.