如何在 PHP 中检查 arangodb 中的集合总数?
这是我尝试过的:
$documents = $collectionHandler->all($collectionId);
var_dump($documents);
如何在 PHP 中检查 arangodb 中的集合总数?
这是我尝试过的:
$documents = $collectionHandler->all($collectionId);
var_dump($documents);
要获取当前集合的数量,您可以CollectionHandler::getAllCollections()
用于此目的:
// create the connection as usual
$handler = new \triagens\ArangoDb\CollectionHandler($connection);
$collections = $handler->getAllCollections();
$collectionNames = array_values($collections);
$collectionCount = count($collectionNames);
如您的代码示例所示,要获取集合中的文档数,请使用CollectionHandler::count($collection)