Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Database
Created by Guest
Created on Jun 22, 2022

Add a $sample accumulator operator

So that it's easier to sample a number of items from each group, instead of writing lengthy DSL like this: https://www.mongodb.com/community/forums/t/sample-x-number-of-documents-in-each-group-with-or-after-a-group-stage/170787 Ideally it can be expressed like this: ` { $group: { _id: '$year', samples: { $sample: 100 }, } } ` Hence making sampling 100 items from each group a snap to achieve!
  • Attach files