1

ArangoDB-PHP でコレクションが既に存在するかどうかを確認したいと思います。

$collectionHandler = new CollectionHandler($arango);
$userCollection = new Collection();
$userCollection->setName('_profiles');

次のエラーが表示されるためです。

Server error: 1207:cannot create collection: duplicate name cannot create collection: duplicate name

ArangoDB-PHP でコレクションが既に存在するかどうかを確認するにはどうすればよいですか?

4

2 に答える 2

1

try/catch ステートメントを使用する必要があります

try { 
    $collectionHandler = new CollectionHandler($arango);
    $userCollection = new Collection();
    $userCollection->setName('_profiles');
    $collectionHandler->create($userCollection);
} catch (ServerException $e) {
    // do something
}
于 2014-10-27T16:59:45.023 に答える