public function count($collection)
    {
        $collection = $this->makeCollection($collection);
        $url        = UrlHelper::buildUrl(Urls::URL_COLLECTION, [$collection, self::OPTION_COUNT]);
        $response   = $this->getConnection()->get($url);

        $data  = $response->getJson();
        $count = $data[self::OPTION_COUNT];

        return (int) $count;
    }
public function count($collection)
    {
        $collection = $this->makeCollection($collection);
        $url        = UrlHelper::buildUrl(Urls::URL_COLLECTION, [$collection, self::OPTION_COUNT]);
        $response   = $this->getConnection()->get($url);

        $data  = $response->getJson();
        $count = $data[self::OPTION_COUNT];

        return (int) $count;
    }
public function count ( $ collection ) { $ collection = $ this -> makeCollection ( $ collection ) ; $ url = UrlHelper :: buildUrl ( Urls :: URL_COLLECTION , [ $ collection , self :: OPTION_COUNT ] ) ; $ response = $ this -> getConnection ( ) -> get ( $ url ) ; $ data = $ response -> getJson ( ) ; $ count = $ data [ self :: OPTION_COUNT ] ; return ( int ) $ count ; }
Get the number of documents in a collection

This will throw if the collection cannot be fetched from the server

@throws Exception

@param mixed $collection - collection id as a string or number

@return int - the number of documents in the collection
Get the number of documents in a collection