public function any($collectionId)
    {
        $_documentClass = $this->_documentClass;

        $data = [
            self::OPTION_COLLECTION => $collectionId,
        ];

        $response = $this->getConnection()->put(Urls::URL_ANY, $this->json_encode_wrapper($data));
        $data     = $response->getJson();

        if ($data['document']) {
            return $_documentClass::createFromArray($data['document']);
        }

        return null;
    }
public function any($collectionId)
    {
        $_documentClass = $this->_documentClass;

        $data = [
            self::OPTION_COLLECTION => $collectionId,
        ];

        $response = $this->getConnection()->put(Urls::URL_ANY, $this->json_encode_wrapper($data));
        $data     = $response->getJson();

        if ($data['document']) {
            return $_documentClass::createFromArray($data['document']);
        }

        return null;
    }
public function any ( $ collectionId ) { $ _documentClass = $ this -> _documentClass ; $ data = [ self :: OPTION_COLLECTION => $ collectionId , ] ; $ response = $ this -> getConnection ( ) -> put ( Urls :: URL_ANY , $ this -> json_encode_wrapper ( $ data ) ) ; $ data = $ response -> getJson ( ) ; if ( $ data [ 'document' ] ) { return $ _documentClass :: createFromArray ( $ data [ 'document' ] ) ; } return null ; }
Get a random document from the collection.

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


@throws Exception

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

@return Document - the document fetched from the server
@since 1.2
Get a random document from the collection .