Load the practice collection
Run once in mongosh against a development instance with an empty parcels practice collection.
const lab = db.getSiblingDB("keplergrid_practice")
lab.parcels.insertMany(Array.from({ length: 12 }, (_, i) => ({
_id: i + 1, state: i < 8 ? "ready" : "held"
})))
In KeplerGrid, open keplergrid_practice.parcels with a Read only connection.
Sample three records from the intended population
Paste the pipeline into Aggregation → JSON. Put $match first so the random sample is drawn from ready parcels only.
[
{ "$match": { "state": "ready" } },
{ "$sample": { "size": 3 } },
{ "$sort": { "_id": 1 } }
]
Expect three distinct ready parcel IDs from 1 through 8. Their order is stable within one result because of the final sort. The selected IDs can change each time you run the pipeline.
Keep the selected IDs when a review must be repeatable
Copy the returned IDs and query them with $in for a later review. A fresh pipeline export that includes $sample can select a different set. For a coverage check, sample each relevant group deliberately instead of relying on one small random draw.
See how to export all results returned by a pipeline or revisit the related KeplerGrid walkthrough.