Class Densify


  • public class Densify
    extends Stage
    Creates new documents in a sequence of documents where certain values in a field are missing.

    You can use $densify to:

    • Fill gaps in time series data.
    • Add missing values between groups of data.
    • Populate your data with a specified range of values.
    Since:
    2.3
    Since server release
    5.1
    • Method Detail

      • densify

        public static Densify densify​(String field,
                                      Densify.Range range)
        Creates new documents in a sequence of documents where certain values in a field are missing.

        You can use $densify to:

        • Fill gaps in time series data.
        • Add missing values between groups of data.
        • Populate your data with a specified range of values.
        Parameters:
        field - The field to densify. The values of the specified field must either be all numeric values or all dates.
        range - specifies how the data is densified.
        Returns:
        the new stage
        Since:
        2.3
        Since server release
        5.1
        MongoDB documentation
        Aggregration Expression: $densify
      • field

        @MorphiaInternal
        public String field()
        Returns:
        this
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • partitionByFields

        public Densify partitionByFields​(String... partitionByFields)
        The set of fields to act as the compound key to group the documents. In the $densify stage, each group of documents is known as a partition.

        If you omit this field, $densify uses one partition for the entire collection.

        Parameters:
        partitionByFields - the fields to partition by
        Returns:
        this
      • partitionByFields

        @MorphiaInternal
        public List<String> partitionByFields()
        Returns:
        this
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • range

        @MorphiaInternal
        public Densify.Range range()
        Returns:
        this
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.