Docs Menu

Docs HomeView & Analyze DataMongoDB Compass

Sampling

Sampling in MongoDB Compass is the selection of a subset of documents from a collection for analysis. Analyzing a sample set of data is a common statistical analysis technique; the results of analyzing a sample set tend to be similar to the results of analyzing an entire data set.

Compass uses sampling for efficiency. Generally, standard sample sets can be selected and analyzed in a few seconds. Analyzing large samples or entire collections demands significantly more time and processing power.

MongoDB Compass samples 1,000 documents from a collection using the $sample operator via the aggregation pipeline. This provides efficient, random sampling without replacement over an entire collection, or over the subset of documents specified by a query.

← Set Validation Rules for Your Schema