embedInLookup

Writes this pipeline's contribution into a $lookup stage.

This method is a low-level API for building custom $lookup stages. Regular users should use HasLookup.lookup instead.

Implementation contract

When a $lookup stage embeds this pipeline as its foreign collection, it calls this method from within the $lookup body. This method should emit the from field, and optionally the pipeline array when the pipeline has stages:

{
"from": "<collection>",
"pipeline": [ <stage1>, ... ]
}

If the pipeline has no stages, pipeline should not be emitted.

See also

The $lookup stage.