Class Lookup


  • public class Lookup
    extends Stage
    Performs a left outer join to an unsharded collection in the same database to filter in documents from the “joined” collection for processing. To each input document, the $lookup stage adds a new array field whose elements are the matching documents from the “joined” collection. The $lookup stage passes these reshaped documents to the next stage.
    Since:
    2.0
    • Constructor Detail

      • Lookup

        protected Lookup​(Class<?> fromType)
      • Lookup

        protected Lookup​(String from)
    • Method Detail

      • from

        public static Lookup from​(Class<?> from)
        Creates a new stage using the target collection for the mapped type
        Parameters:
        from - the type to use for determining the target collection
        Returns:
        the new stage
      • from

        public static Lookup from​(String from)
        Creates a new stage using the target collection
        Parameters:
        from - the target collection
        Returns:
        the new stage
      • as

        public Lookup as​(String as)
        Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document.
        Parameters:
        as - the name
        Returns:
        this
      • foreignField

        public Lookup foreignField​(String foreignField)
        Specifies the field from the documents in the from collection.
        Parameters:
        foreignField - the field name
        Returns:
        this
      • getAs

        public String getAs()
        Returns:
        the value
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getForeignField

        public String getForeignField()
        Returns:
        the value
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getFrom

        public String getFrom()
        Returns:
        the value
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getFromType

        public Class<?> getFromType()
        Returns:
        the value
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getLocalField

        public String getLocalField()
        Returns:
        the value
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getVariables

        public DocumentExpression getVariables()
        Returns:
        the embeded pipeline's variables
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • let

        public Lookup let​(String name,
                          Expression expression)
        Defines a variable
        Parameters:
        name - the variable name
        expression - the variable value expression
        Returns:
        this
      • localField

        public Lookup localField​(String localField)
        Specifies the field from the documents input to the $lookup stage.
        Parameters:
        localField - the field name
        Returns:
        this