File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
src/main/java/com/arangodb Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -782,15 +782,12 @@ public Collection<IndexEntity> getIndexes() throws ArangoDBException {
782
782
* @return true if the collection exists, otherwise false
783
783
*/
784
784
public boolean exists () throws ArangoDBException {
785
- boolean exists = false ;
786
- final Collection <CollectionEntity > collections = db ().getCollections ();
787
- for (final CollectionEntity collection : collections ) {
788
- if (collection .getName ().equals (name ())) {
789
- exists = true ;
790
- break ;
791
- }
785
+ try {
786
+ getInfo ();
787
+ return true ;
788
+ } catch (final ArangoDBException e ) {
789
+ return false ;
792
790
}
793
- return exists ;
794
791
}
795
792
796
793
/**
Original file line number Diff line number Diff line change @@ -96,7 +96,12 @@ public ArangoDBVersion getVersion() throws ArangoDBException {
96
96
* @return true if the database exists, otherwise false
97
97
*/
98
98
public boolean exists () throws ArangoDBException {
99
- return arango ().getDatabases ().contains (name ());
99
+ try {
100
+ getInfo ();
101
+ return true ;
102
+ } catch (final ArangoDBException e ) {
103
+ return false ;
104
+ }
100
105
}
101
106
102
107
/**
You can’t perform that action at this time.
0 commit comments