Class Miscellaneous
- java.lang.Object
-
- dev.morphia.aggregation.experimental.expressions.Miscellaneous
-
public final class Miscellaneous extends Object
Defines miscellaneous operators for aggregations.- Since:
- 2.2
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Expression
rand()
Returns a random float between 0 and 1.static Filter
sampleRate(double rate)
Matches a random selection of input documents.
-
-
-
Method Detail
-
rand
public static Expression rand()
Returns a random float between 0 and 1.- Returns:
- the filter
- Since:
- 2.2
- MongoDB documentation
- Aggregration Expression: $rand
-
sampleRate
public static Filter sampleRate(double rate)
Matches a random selection of input documents. The number of documents selected approximates the sample rate expressed as a percentage of the total number of documents.- Parameters:
rate
- the rate to check against- Returns:
- the filter
- Since:
- 2.2
- MongoDB documentation
- Aggregration Expression: $sampleRate
-
-