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
Modifier and TypeMethodDescriptionstatic DateDensifyRange
fullRangeWithStep
(long step, MongoTimeUnit unit) Returns aDensifyRange
that represents an interval with the smallest BSONDate
value of the field in the sequence of documents being its lower bound, and the largest value being the upper bound.static NumberDensifyRange
fullRangeWithStep
(Number step) Returns aDensifyRange
that represents an interval with the smallest BSON32-bit integer
/64-bit integer
/Double
/Decimal128
value of the field in the sequence of documents being its lower bound, and the largest value being the upper bound.static DensifyRange
Creates aDensifyRange
from aBson
in situations when there is no builder method that better satisfies your needs.static DateDensifyRange
partitionRangeWithStep
(long step, MongoTimeUnit unit) Returns aDensifyRange
that represents an interval with the smallest BSONDate
value of the field in the partition of documents being its lower bound, and the largest value being the upper bound.static NumberDensifyRange
partitionRangeWithStep
(Number step) Returns aDensifyRange
that represents an interval with the smallest BSON32-bit integer
/64-bit integer
/Double
/Decimal128
value of the field in the partition of documents being its lower bound, and the largest value being the upper bound.static NumberDensifyRange
rangeWithStep
(Number l, Number u, Number step) Returns aDensifyRange
that represents a single interval [l, u).static DateDensifyRange
rangeWithStep
(Instant l, Instant u, long step, MongoTimeUnit unit) Returns aDensifyRange
that represents a single interval [l, u).Methods inherited from interface org.bson.conversions.Bson
toBsonDocument, toBsonDocument
-
Method Details
-
fullRangeWithStep
Returns aDensifyRange
that represents an interval with the smallest BSON32-bit integer
/64-bit integer
/Double
/Decimal128
value 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 aDensifyRange
that represents an interval with the smallest BSON32-bit integer
/64-bit integer
/Double
/Decimal128
value 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 aDensifyRange
that represents a single interval [l, u).- Parameters:
l
- The lower bound.u
- The upper bound.step
- The step.- Returns:
- The requested
DensifyRange
.
-
fullRangeWithStep
Returns aDensifyRange
that represents an interval with the smallest BSONDate
value 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 thestep
is specified.- Returns:
- The requested
DensifyRange
.
-
partitionRangeWithStep
Returns aDensifyRange
that represents an interval with the smallest BSONDate
value 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 thestep
is specified.- Returns:
- The requested
DensifyRange
.
-
rangeWithStep
Returns aDensifyRange
that represents a single interval [l, u).- Parameters:
l
- The lower bound.u
- The upper bound.step
- The step.unit
- The unit in which thestep
is specified.- Returns:
- The requested
DensifyRange
.
-
of
Creates aDensifyRange
from aBson
in 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 equivalentDensifyRange
s, 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
- ABson
representing the requiredDensifyRange
.- Returns:
- The requested
DensifyRange
.
-