Docs HomeMongoDB Compass

Sampling采样

Sampling in MongoDB Compass is the selection of a subset of documents from a collection for analysis. MongoDB Compass中的采样是从一个集合中选择一个子集进行分析。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. Compass使用采样来提高效率。通常,可以在几秒钟内选择并分析标准样本集。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 operator via the aggregation pipeline. MongoDB Compass通过聚合管道使用$sample运算符从集合中采样1000个文档。This provides efficient, random sampling without replacement over an entire collection, or over the subset of documents specified by a query.这提供了高效的随机采样,而无需对整个集合或查询指定的文档子集进行替换。