Drop collection if exists

22 views
Skip to first unread message

Kevin Sheppard

unread,
Mar 10, 2017, 4:11:58 PM3/10/17
to ArangoDB
Is there "drop collection if exists" functionality in the ArangoDB Shell or Java driver? Would be quite handy for tests.

Jan

unread,
Mar 13, 2017, 3:57:58 AM3/13/17
to ArangoDB
The ArangoDB shell has a "db._drop(collectionName)" command.
It can be called for an existing or a non-existing collection. When called for an existing collection, it will drop it. When called for a non-existing collection, it won't do anything (i.e. not fail and not throw an exception).
Does that help?

mpv1989

unread,
Mar 13, 2017, 4:29:44 AM3/13/17
to ArangoDB
The method `ArangoCollection.drop()` throws an exception if the collection does not exists. For tests it should be enough to surround the call with `try { ... } catch(ArangoDBException e){}`

Am Freitag, 10. März 2017 22:11:58 UTC+1 schrieb Kevin Sheppard:

Kevin Sheppard

unread,
Mar 13, 2017, 12:28:33 PM3/13/17
to ArangoDB

I think the exception catching could work. Thanks.


--
You received this message because you are subscribed to a topic in the Google Groups "ArangoDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/arangodb/F5sh0qjbq5c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to arangodb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
- Kevin
Reply all
Reply to author
Forward
0 new messages