Package com.mongodb.client.model.densify
Interface DensifyRange
- All Superinterfaces:
Bson
- All Known Subinterfaces:
DateDensifyRange,NumberDensifyRange
A specification of how to compute the missing field values
for which new documents must be added. It specifies a half-closed interval of values with the lower bound being inclusive, and a step.
The first potentially missing value within each interval is its lower bound, other values are computed by adding the step
multiple times, until the result is out of the interval. Each time the step is added, the result is a potentially missing value for
which a new document must be added if the sequence of documents that is being densified does not have a document
with equal value of the field.
- Since:
- 4.7
- See Also:
- Since server release
- 5.1
-
Field Summary
Fields inherited from interface org.bson.conversions.Bson
DEFAULT_CODEC_REGISTRY -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic DateDensifyRangefullRangeWithStep(long step, MongoTimeUnit unit) Returns aDensifyRangethat represents an interval with the smallest BSONDatevalue of the field in the sequence of documents being its lower bound, and the largest value being the upper bound.static NumberDensifyRangefullRangeWithStep(Number step) Returns aDensifyRangethat represents an interval with the smallest BSON32-bit integer/64-bit integer/Double/Decimal128value of the field in the sequence of documents being its lower bound, and the largest value being the upper bound.static DensifyRangeCreates aDensifyRangefrom aBsonin situations when there is no builder method that better satisfies your needs.static DateDensifyRangepartitionRangeWithStep(long step, MongoTimeUnit unit) Returns aDensifyRangethat represents an interval with the smallest BSONDatevalue of the field in the partition of documents being its lower bound, and the largest value being the upper bound.static NumberDensifyRangepartitionRangeWithStep(Number step) Returns aDensifyRangethat represents an interval with the smallest BSON32-bit integer/64-bit integer/Double/Decimal128value of the field in the partition of documents being its lower bound, and the largest value being the upper bound.static NumberDensifyRangerangeWithStep(Number l, Number u, Number step) Returns aDensifyRangethat represents a single interval [l, u).static DateDensifyRangerangeWithStep(Instant l, Instant u, long step, MongoTimeUnit unit) Returns aDensifyRangethat represents a single interval [l, u).Methods inherited from interface org.bson.conversions.Bson
toBsonDocument, toBsonDocument
-
Method Details
-
fullRangeWithStep
Returns aDensifyRangethat represents an interval with the smallest BSON32-bit integer/64-bit integer/Double/Decimal128value of the field in the sequence of documents being its lower bound, and the largest value being the upper bound.- Parameters:
step- The step.- Returns:
- The requested
DensifyRange.
-
partitionRangeWithStep
Returns aDensifyRangethat represents an interval with the smallest BSON32-bit integer/64-bit integer/Double/Decimal128value of the field in the partition of documents being its lower bound, and the largest value being the upper bound.- Parameters:
step- The step.- Returns:
- The requested
DensifyRange.
-
rangeWithStep
Returns aDensifyRangethat represents a single interval [l, u).- Parameters:
l- The lower bound.u- The upper bound.step- The step.- Returns:
- The requested
DensifyRange.
-
fullRangeWithStep
Returns aDensifyRangethat represents an interval with the smallest BSONDatevalue of the field in the sequence of documents being its lower bound, and the largest value being the upper bound.- Parameters:
step- The step.unit- The unit in which thestepis specified.- Returns:
- The requested
DensifyRange.
-
partitionRangeWithStep
Returns aDensifyRangethat represents an interval with the smallest BSONDatevalue of the field in the partition of documents being its lower bound, and the largest value being the upper bound.- Parameters:
step- The step.unit- The unit in which thestepis specified.- Returns:
- The requested
DensifyRange.
-
rangeWithStep
Returns aDensifyRangethat represents a single interval [l, u).- Parameters:
l- The lower bound.u- The upper bound.step- The step.unit- The unit in which thestepis specified.- Returns:
- The requested
DensifyRange.
-
of
Creates aDensifyRangefrom aBsonin situations when there is no builder method that better satisfies your needs. This method cannot be used to validate the syntax.Example
The following code creates two functionally equivalentDensifyRanges, though they may not be equal.DensifyRange range1 = DensifyRange.partitionRangeWithStep( 1, MongoTimeUnit.MINUTE); DensifyRange range2 = DensifyRange.of(new Document("bounds", "partition") .append("step", 1).append("unit", MongoTimeUnit.MINUTE.value()));- Parameters:
range- ABsonrepresenting the requiredDensifyRange.- Returns:
- The requested
DensifyRange.
-