Class Fill

java.lang.Object
dev.morphia.aggregation.stages.Stage
dev.morphia.aggregation.stages.Fill

public class Fill extends Stage
Populates null and missing field values within documents.

You can use $fill to populate missing data points:

  • In a sequence based on surrounding values.
  • With a fixed value.
Since:
2.3
Since server release
5.3
  • Method Details

    • fill

      public static Fill fill()
      Creates a new $fill stage
      Returns:
      the new stage
      MongoDB documentation
      Aggregration Pipeline Stage: $fill
      Since server release
      5.3
    • field

      public Fill field(String name, Object value)
      Specifies an object indicating how to fill missing values in the target field.
      Parameters:
      name - the field name
      value - the value to fill with
      Returns:
      this
    • field

      public Fill field(String name, Fill.Method method)
      Specifies an object indicating how to fill missing values in the target field.
      Parameters:
      name - the field name
      method - the method to use when filling in missing values
      Returns:
      this
    • partitionBy

      public Fill partitionBy(Expression partitionBy)
      Specifies an array of fields as the compound key to group the documents.
      Parameters:
      partitionBy - the partition expression
      Returns:
      this
    • partitionByFields

      public Fill partitionByFields(String... fields)
      Specifies an array of fields as the compound key to group the documents.
      Parameters:
      fields - the fields
      Returns:
      this
    • sortBy

      public Fill sortBy(Sort... sorts)
      Specifies the field or fields to sort the documents within each partition.
      Parameters:
      sorts - the sorting values to apply
      Returns:
      this