ReplaceRoot constructor

ReplaceRoot(
  1. dynamic replacement
)

Creates $replaceRoot aggrregation stage

The replacement document can be any valid expression that resolves to a document. The stage errors and fails if replacement is not a document.

Implementation

ReplaceRoot(replacement)
    : super('replaceRoot', AEObject({'newRoot': replacement}));