Sample class

$sample aggregation stage

Stage description.

$sample randomly selects a specified number of documents from the aggregation pipeline. This stage can be useful for sampling a subset of documents from a larger dataset.

You can include only one $sample stage in an aggregation pipeline.

Example:

Dart code

Sample(10).build()

Equivalent mongoDB aggregation stage:

{
  $sample: {
    size: 10
  }
}

https://docs.mongodb.com/manual/reference/operator/aggregation/sample/

Inheritance

Constructors

Sample(int size)
Creates $sample aggregation stage

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build() Map<String, Object>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited