Skip to content

HasLookupPipelineCompatibility

Pipeline that can be used as the foreign collection in a `$lookup stage`.

Instances of this interface should be immutable.

Inheritors

Properties

context

The context used to generate this pipeline.

Functions

embedInLookup

@LowLevelApi
abstract fun embedInLookup(writer: BsonFieldWriter)

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

reinterpret

Changes the type of the returned document, with no type-safety.

toString

abstract override fun toString(): String

JSON representation of this pipeline.

withStage

Creates a new pipeline that expands on the current one by adding stage.

writeTo

@LowLevelApi
abstract fun writeTo(writer: BsonValueWriter)

Writes the entire pipeline into writer.