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 {
782782 * @return true if the collection exists, otherwise false
783783 */
784784 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 ;
792790 }
793- return exists ;
794791 }
795792
796793 /**
Original file line number Diff line number Diff line change @@ -96,7 +96,12 @@ public ArangoDBVersion getVersion() throws ArangoDBException {
9696 * @return true if the database exists, otherwise false
9797 */
9898 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+ }
100105 }
101106
102107 /**
You can’t perform that action at this time.
0 commit comments