See https://github.com/mongodb/mongo/blob/a9a1aec2819dfca8795e022817189a651a09d2e4/src/mongo/db/commands/run_aggregate.cpp#L537-L538