Interface DensifyRange

All Superinterfaces:
Bson
All Known Subinterfaces:
DateDensifyRange, NumberDensifyRange

@Evolving public interface DensifyRange extends Bson
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
  • Method Details

    • fullRangeWithStep

      static NumberDensifyRange fullRangeWithStep(Number step)
      Returns a DensifyRange that represents an interval with the smallest BSON 32-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

      static NumberDensifyRange partitionRangeWithStep(Number step)
      Returns a DensifyRange that represents an interval with the smallest BSON 32-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

      static NumberDensifyRange rangeWithStep(Number l, Number u, Number step)
      Returns a DensifyRange that represents a single interval [l, u).
      Parameters:
      l - The lower bound.
      u - The upper bound.
      step - The step.
      Returns:
      The requested DensifyRange.
    • fullRangeWithStep

      static DateDensifyRange fullRangeWithStep(long step, MongoTimeUnit unit)
      Returns a DensifyRange that represents an interval with the smallest BSON Date 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 the step is specified.
      Returns:
      The requested DensifyRange.
    • partitionRangeWithStep

      static DateDensifyRange partitionRangeWithStep(long step, MongoTimeUnit unit)
      Returns a DensifyRange that represents an interval with the smallest BSON Date 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 the step is specified.
      Returns:
      The requested DensifyRange.
    • rangeWithStep

      static DateDensifyRange rangeWithStep(Instant l, Instant u, long step, MongoTimeUnit unit)
      Returns a DensifyRange that represents a single interval [l, u).
      Parameters:
      l - The lower bound.
      u - The upper bound.
      step - The step.
      unit - The unit in which the step is specified.
      Returns:
      The requested DensifyRange.
    • of

      static DensifyRange of(Bson range)
      Creates a DensifyRange from a Bson 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 equivalent DensifyRanges, 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 - A Bson representing the required DensifyRange.
      Returns:
      The requested DensifyRange.