Class Lookup
- java.lang.Object
-
- dev.morphia.aggregation.experimental.stages.Stage
-
- dev.morphia.aggregation.experimental.stages.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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Lookup
as(String as)
Name of the array field added to each output document.Lookup
foreignField(String foreignField)
Specifies the field from the documents in the from collection.static Lookup
from(Class<?> from)
Creates a new stage using the target collection for the mapped typestatic Lookup
from(String from)
Creates a new stage using the target collectionString
getAs()
String
getForeignField()
String
getFrom()
Class<?>
getFromType()
String
getLocalField()
DocumentExpression
getVariables()
Lookup
let(String name, Expression expression)
Defines a variableLookup
localField(String localField)
Specifies the field from the documents input to the $lookup stage.-
Methods inherited from class dev.morphia.aggregation.experimental.stages.Stage
getStageName
-
-
-
-
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 nameexpression
- the variable value expression- Returns:
- this
-
-