> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Sampling

MongoDB Compass Readonly Edition will be deprecated in a future release. To replicate the read-only behavior in a standard Compass edition, assign users [`read`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-authrole-read) access at the database level and enable the [readOnly](https://www.mongodb.com/docs/compass/settings/read-only.md#std-label-compass-read-only) option in Compass.

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.

## Sampling Method

MongoDB Compass samples 1,000 documents from a collection using the [$sample](https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/) operator via the [aggregation pipeline](https://www.mongodb.com/docs/manual/core/aggregation-pipeline/). This provides efficient, random sampling without replacement over an entire collection, or over the subset of documents specified by a query.
