【问题标题】:Check total number of collections in arangodb in PHP在 PHP 中检查 arangodb 中的集合总数
【发布时间】:2016-10-27 14:22:52
【问题描述】:

如何在 PHP 中查看 arangodb 中的集合总数?

这是我尝试过的:

$documents = $collectionHandler->all($collectionId);

var_dump($documents);

【问题讨论】:

  • 您可以提供任何进展或其他反馈吗?答案解决了你的问题吗?

标签: arangodb arangodb-php


【解决方案1】:

要获取当前集合的数量,您可以为此目的使用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)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-21
    • 2021-10-07
    相关资源
    最近更新 更多