Class Projection


  • public class Projection
    extends Stage
    Passes along the documents with the requested fields to the next stage in the pipeline. The specified fields can be existing fields from the input documents or newly computed fields.
    • Constructor Detail

      • Projection

        protected Projection()
    • Method Detail

      • of

        public static Projection of()
        Creates a new stage
        Returns:
        the new stage
      • exclude

        public Projection exclude​(String name)
        Excludes a field.
        Parameters:
        name - the field name
        Returns:
        this
      • include

        public Projection include​(String name,
                                  Expression value)
        Includes a field.
        Parameters:
        name - the field name
        value - the value expression
        Returns:
        this
      • getFields

        public List<PipelineField> getFields()
        Returns:
        the fields
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • include

        public Projection include​(String name)
        Includes a field.
        Parameters:
        name - the field name
        Returns:
        this
      • suppressId

        public Projection suppressId()
        Suppresses the _id field in the resulting document.
        Returns:
        this