Explain aggregation

@deprecated use pipeline option 'explain' in Collection::aggregate() or method Pipeline::explain()
@param array|Pipeline $pipeline
@return array result
@throws Exception
7173
public function explainAggregate($pipeline)
    {
        if (version_compare($this->getDatabase()->getClient()->getDbVersion(), '2.6.0', '<')) {
            throw new Exception('Explain of aggregation implemented only from 2.6.0');
        }

        if ($pipeline instanceof Pipeline) {
            $pipeline = $pipeline->toArray();
        } elseif (!is_array($pipeline)) {
            throw new Exception('Wrong pipeline specified');
        }

        // aggregate
        return $this->database->executeCommand(array(
            'aggregate' => $this->getName(),
            'pipeline'  => $pipeline,
            'explain'   => true
        ));
    }
68609
public function aggregate(array $pipeline, array $options = [])
    {
        if (array_key_exists('pipeline', $options)) {
            throw new InvalidArgumentException('Option "pipeline" is not allowed, use $pipeline argument.');
        }

        return $this->executeCommand(
            ['aggregate' => $this->collectionName],
            ['pipeline' => $pipeline] + $options
        );
    }
394307
public function explain()
    {
        $cursor = $this;
        return $this->retry(function() use ($cursor) {
            return $cursor->getMongoCursor()->explain();
        }, true);
    }
821705
private function handlePipeline(MatchablePipelineCollectionInterface $pipelines): ?ResponseInterface
    {
        /** @var MatchablePipelineInterface $pipeline */
        foreach ($pipelines as $pipeline) {
            if ($pipeline->matchBy($this->matchableRequest)) {
                $stages = \array_merge($this->stages(), $pipeline->stages());
                $pipelineResponse = $this->processor->processStages($stages, $this->matchableRequest->request());

                if ($pipelineResponse instanceof ResponseInterface) {
                    return $pipelineResponse;
                }

                $body = $this->response->getBody();
                $body->write($pipelineResponse);

                return $this->response->withBody($body);
            }
        }

        return null;
    }
1185449
def get_pipeline(self, *args, **kwargs):
        '''
        

        '''

        return getattr(missions, self.mission).pipelines.get(self.ID, *args,
                                                             **kwargs)
111917
public function getAggregate($params = [])
    {
        if ($this->getMultipipeline()) {
            $pipelines = [];
            foreach ($this->class as $name => $className) {
                if (!class_exists($className)) {
                    throw new \LogicException("Analytics class '" . $className . "' does not exist!");
                }
                $class = new $className();
                $class->setParams($params);
                $pipelines[$name] = $class->get();
            }
            return $pipelines;
        } else {
            $className = $this->class;
            if (!class_exists($className)) {
                throw new \LogicException("Analytics class '" . $className . "' does not exist!");
            }
            $class = new $className();
            $class->setParams($params);
            return $class->get();
        }
    }
1118741
protected function createSlice($stack, $pipe)
    {
        return function ($passable) use ($stack, $pipe)
        {
            try {
                return $this->call($pipe, $passable, $stack);
            }
            catch (Exception $e) {
                return $this->handleException($passable, $e);
            }
            catch (Throwable $e) {
                return $this->handleException($passable, new FatalThrowableError($e));
            }
        };
    }
348969
func (p *Pipeline) Explain() string {
	var explanation string

	// Sort from most failures to least

	sortedByFailures := make([]checklistEntry, len(p.checklist))
	copy(sortedByFailures, p.checklist)
	sort.Sort(sort.Reverse(checklistByFailures(sortedByFailures)))

	for _, entry := range sortedByFailures {
		if entry.failureCount > 0 {
			if len(explanation) > 0 {
				explanation += "; "
			}
			explanation += entry.f.Explain(entry.failureCount)
		}
	}

	return explanation
}
636785
private function createParameters($pipe, $request, $stack, $isString = false)
    {
        if ($isString) {
            list($name, $parameters) = $this->parsePipeString($pipe);

            if (!is_object($this->container)) {
                throw new PipelineException(sprintf('%s expects container instance', get_class($this)));
            }

            $pipe = ($this->container->has($name)) ? $this->container->get($name) : $this->container->make($name);
            $parameters = array_merge([$request, $stack], $parameters);
        } else {
            $parameters = [$request, $stack];
        }

        return [[$pipe, $this->method], $parameters];
    }
19731
public function pipeline(Closure $pipeline): array
	{
		// Enable pipelining

		$this->pipelined = true;

		// Build commands

		$pipeline($this);

		// Send all commands to server and fetch responses

		$responses = [];

		$commands = count($this->commands);

		$this->sendCommandToServer(implode('', $this->commands));

		for($i = 0; $i < $commands; $i++)
		{
			$responses[] = $this->getResponse();
		}

		// Reset pipelining

		$this->commands = [];

		$this->pipelined = false;

		// Return array of responses

		return $responses;
	}
984832
private function explainOneOf($data, $explanation, $currentPath, $isArray = false)
    {
        $explanation->addOneOf(array_map(function ($oneOf) use ($currentPath, $isArray) {
            return $this->explainSchema($oneOf, null, $currentPath, $isArray);
        }, $data->oneOf), 'an auto generated descr', true);
    }
517420
def build_pipeline(self, collection):
        
        pipeline = []

        if isinstance(collection.where_dict, dict) and collection.where_dict:
            match_dict = {
                "$match": collection.where_dict
            }
            pipeline.append(match_dict)

        group_keys_dict = self.build_mongo_doc(self.join_keys)
        push_dict = self.build_mongo_doc(collection.select_keys)

        group_by_dict = {
            "$group":
                {
                    "_id": group_keys_dict,
                    "docs": {
                        "$push": push_dict
                    }
                }
        }

        pipeline.append(group_by_dict)

        return pipeline
408764
public function explain($collectionName, $query)
    {
        $query = array_merge(
            ['find' => $collectionName],
            $query
        );

        if (isset($query['filter'])) {
            $query['filter'] = (object) $this->buildCondition($query['filter']);
        }
        if (isset($query['projection'])) {
            $query['projection'] = $this->buildSelectFields($query['projection']);
        }
        if (isset($query['sort'])) {
            $query['sort'] = $this->buildSortFields($query['sort']);
        }

        return [
            'explain' => $query,
        ];
    }
671643
protected function parsePipeData($pipe)
    {
        if (is_array($pipe)) {
            if (!$pipe[0]) {
                throw  new Exception('I need to know name of service (class)');
            }
            $name = $pipe[0];
            $method = $pipe[1];
            $parameters = $pipe[2];
            $needContainer = $pipe[3];
        } else {
            list($name, $method, $parameters) = array_pad(explode(':', $pipe, 3), 3, null);
            $needContainer = null;
        }

        if (is_string($parameters)) {
            $parameters = explode(',', $parameters);
        }

        return [$name, $method, $parameters, $needContainer];
    }
905548
private function parseRouteConfiguration($route)
    {
        if (!is_array($route)) {
            throw new Exception("Strata configuration file contains an invalid route.");
        }

        return $this->isDynamic($route) ?
            $this->parseDynamicRoute($route) :
            $this->parseMatchedRoute($route);
    }
588866
public function pipe($object, $pipeline = null)
    {
        $pipeline = $pipeline ?: 'default';

        return call_user_func(
            $this->pipelines[$pipeline], new Pipeline($this->container), $object
        );
    }
728335
protected function runAsynchronously(Pipeline $pipeline)
    {
        $this->parallel = $this->parallel ?: new Parallel();

        // Check if supported
        if (!$this->parallel->isSupported()) {
            throw new Exception('Parallel jobs require the PCNTL extension');
        }

        try {
            $results = $this->parallel->values($pipeline->all());
            $pipeline->setResults($results);
        } catch (LogicException $exception) {
            return $this->runSynchronously($pipeline);
        }

        return $pipeline;
    }