Lookup constructor

Lookup({
  1. required String from,
  2. required String localField,
  3. required String foreignField,
  4. required String as,
})

Creates ordinary $lookup stage

  • from - Specifies the collection in the same database to perform the join with. The from collection cannot be sharded.
  • localField - Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes.
  • foreignField - Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes.
  • as - Specifies the name of the new array field to add to the input documents. The new array field contains the matching documents from the from collection. If the specified name already exists in the input document, the existing field is overwritten.

Implementation

Lookup(
    {required String from,
    required String localField,
    required String foreignField,
    required String as})
    : super(
          'lookup',
          AEObject({
            'from': from,
            'localField': localField,
            'foreignField': foreignField,
            'as': as
          }));