debug

abstract suspend fun debug(limit: Int = 10): MongoAggregationPipeline.PipelineDebugReport(source)

Creates a debug report for this pipeline.

A debug report helps understand what a pipeline does by displaying intermediate results after each stage.

This method is useful during development, in tests, or to evaluate within the debugger.

Example

class User(
val _id: ObjectId,
val name: String,
val age: Int,
)

users.aggregate()
.match { User::age gte 18 }
.sort { descending(User::age) }
.limit(2)
.debug()

Then, print the debug report to the standard output or view it under the debugger.

Parameters

limit

The maximum number of documents to display after each stage.