private function getCollections(array $service, $sshUrl)
    {
        /** @var \Platformsh\Cli\Service\Relationships $relationshipsService */
        $relationshipsService = $this->getService('relationships');
        /** @var \Platformsh\Cli\Service\Ssh $ssh */
        $ssh = $this->getService('ssh');
        /** @var \Platformsh\Cli\Service\Shell $shell */
        $shell = $this->getService('shell');

        $js = 'printjson(db.getCollectionNames())';

        $command = 'mongo '
            . $relationshipsService->getDbCommandArgs('mongo', $service)
            . ' --quiet --eval ' . OsUtil::escapePosixShellArg($js);

        $sshArgs = array_merge(['ssh'], $ssh->getSshArgs());
        $sshArgs[] = $sshUrl;
        $sshArgs[] = $command;

        /** @noinspection PhpUnhandledExceptionInspection */
        $result = $shell->execute($sshArgs, null, true);
        if (!is_string($result)) {
            return [];
        }

        $collections = json_decode($result, true) ?: [];

        return array_filter($collections, function ($collection) {
            return substr($collection, 0, 7) !== 'system.';
        });
    }
private function getCollections(array $service, $sshUrl)
    {
        /** @var \Platformsh\Cli\Service\Relationships $relationshipsService */
        $relationshipsService = $this->getService('relationships');
        /** @var \Platformsh\Cli\Service\Ssh $ssh */
        $ssh = $this->getService('ssh');
        /** @var \Platformsh\Cli\Service\Shell $shell */
        $shell = $this->getService('shell');

        $js = 'printjson(db.getCollectionNames())';

        $command = 'mongo '
            . $relationshipsService->getDbCommandArgs('mongo', $service)
            . ' --quiet --eval ' . OsUtil::escapePosixShellArg($js);

        $sshArgs = array_merge(['ssh'], $ssh->getSshArgs());
        $sshArgs[] = $sshUrl;
        $sshArgs[] = $command;

        /** @noinspection PhpUnhandledExceptionInspection */
        $result = $shell->execute($sshArgs, null, true);
        if (!is_string($result)) {
            return [];
        }

        $collections = json_decode($result, true) ?: [];

        return array_filter($collections, function ($collection) {
            return substr($collection, 0, 7) !== 'system.';
        });
    }
private function getCollections ( array $ service , $ sshUrl ) { /** @var \Platformsh\Cli\Service\Relationships $relationshipsService */ $ relationshipsService = $ this -> getService ( 'relationships' ) ; /** @var \Platformsh\Cli\Service\Ssh $ssh */ $ ssh = $ this -> getService ( 'ssh' ) ; /** @var \Platformsh\Cli\Service\Shell $shell */ $ shell = $ this -> getService ( 'shell' ) ; $ js = 'printjson(db.getCollectionNames())' ; $ command = 'mongo ' . $ relationshipsService -> getDbCommandArgs ( 'mongo' , $ service ) . ' --quiet --eval ' . OsUtil :: escapePosixShellArg ( $ js ) ; $ sshArgs = array_merge ( [ 'ssh' ] , $ ssh -> getSshArgs ( ) ) ; $ sshArgs [ ] = $ sshUrl ; $ sshArgs [ ] = $ command ; /** @noinspection PhpUnhandledExceptionInspection */ $ result = $ shell -> execute ( $ sshArgs , null , true ) ; if ( ! is_string ( $ result ) ) { return [ ] ; } $ collections = json_decode ( $ result , true ) ? : [ ] ; return array_filter ( $ collections , function ( $ collection ) { return substr ( $ collection , 0 , 7 ) !== 'system.' ; } ) ; }
Get collections in the MongoDB database.

@param array  $service
@param string $sshUrl

@return array
Get collections in the MongoDB database .