Class Projection

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Projection add​(java.lang.Object... args)
      Creates an addition projection
      static Projection divide​(java.lang.Object arg1, java.lang.Object arg2)
      Creates a division projection
      static Projection expression​(java.lang.String operator, java.lang.Object... args)
      Provides access to arbitrary expressions taking an array of arguments, such as $concat
      java.util.List<java.lang.Object> getArguments()  
      java.util.List<Projection> getProjections()  
      java.lang.String getSource()  
      java.lang.String getTarget()  
      boolean isSuppressed()  
      static Projection list​(java.lang.Object... args)
      Creates a list projection
      static Projection mod​(java.lang.Object arg1, java.lang.Object arg2)
      Creates a modulo projection
      static Projection multiply​(java.lang.Object... args)
      Creates a multiplication projection
      static Projection projection​(java.lang.String field)
      Creates a projection on a field
      static Projection projection​(java.lang.String field, Projection projection, Projection... subsequent)
      Creates a projection on a field with subsequent projects applied.
      static Projection projection​(java.lang.String field, java.lang.String projectedField)
      Creates a projection on a field and renames it
      static Projection size​(java.lang.Object expression)
      Counts and returns the total the number of items in an array
      static Projection subtract​(java.lang.Object arg1, java.lang.Object arg2)
      Creates a subtraction projection
      Projection suppress()
      Marks this field to be suppressed from the output of this stage
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • projection

        public static Projection projection​(java.lang.String field)
        Creates a projection on a field
        Parameters:
        field - the field
        Returns:
        the projection
      • projection

        public static Projection projection​(java.lang.String field,
                                            java.lang.String projectedField)
        Creates a projection on a field and renames it
        Parameters:
        field - the field
        projectedField - the new field name
        Returns:
        the projection
      • projection

        public static Projection projection​(java.lang.String field,
                                            Projection projection,
                                            Projection... subsequent)
        Creates a projection on a field with subsequent projects applied.
        Parameters:
        field - the field
        projection - the project to apply
        subsequent - the other projections to apply
        Returns:
        the projection
      • expression

        public static Projection expression​(java.lang.String operator,
                                            java.lang.Object... args)
        Provides access to arbitrary expressions taking an array of arguments, such as $concat
        Parameters:
        operator - the operator for the projection
        args - the projection arguments
        Returns:
        the projection
      • list

        public static Projection list​(java.lang.Object... args)
        Creates a list projection
        Parameters:
        args - the projection arguments
        Returns:
        the projection
      • divide

        public static Projection divide​(java.lang.Object arg1,
                                        java.lang.Object arg2)
        Creates a division projection
        Parameters:
        arg1 - subtraction argument
        arg2 - subtraction argument
        Returns:
        the projection
        MongoDB documentation
        reference/operator/aggregation/divide $divide
      • size

        public static Projection size​(java.lang.Object expression)
        Counts and returns the total the number of items in an array
        Parameters:
        expression - The argument for $size can be any expression as long as it resolves to an array.
        Returns:
        the projection
        MongoDB documentation
        reference/operator/aggregation/size $size
      • mod

        public static Projection mod​(java.lang.Object arg1,
                                     java.lang.Object arg2)
        Creates a modulo projection
        Parameters:
        arg1 - subtraction argument
        arg2 - subtraction argument
        Returns:
        the projection
        MongoDB documentation
        reference/operator/aggregation/mod $mod
      • getArguments

        public java.util.List<java.lang.Object> getArguments()
        Returns:
        the arguments for the projection
      • getSource

        public java.lang.String getSource()
        Returns:
        the projected field name
      • getProjections

        public java.util.List<Projection> getProjections()
        Returns:
        any projections applied to this field
      • getTarget

        public java.lang.String getTarget()
        Returns:
        the source field of the projection
      • isSuppressed

        public boolean isSuppressed()
        Returns:
        true if this field is suppressed from the output
      • suppress

        public Projection suppress()
        Marks this field to be suppressed from the output of this stage
        Returns:
        this
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object