Dale
Dale

Reputation: 141

ArangoDB: How to list or export all documents in a database, regardless of collections

I see that there are APIs for listing and exporting all documents within a given collection, but I need to list/export all documents (ids) in all collections in a database simultaneously. (This is for V&V of a service I'm developing). Is this possible, or must I query for each collection one at a time?

Thanks!

Upvotes: 1

Views: 1277

Answers (1)

peak
peak

Reputation: 116740

arangodump will dump all the collections within a database, but the output format for a DOCUMENT is like this:

{"type":2300,"data": DOCUMENT}

There is one such entry per document in a per-collection file, which is named like so:

COLLECTION_07cf4f8f5d8b76282917320715dda2ad.data.json

It would be easy enough to extract DOCUMENT, e.g. using jq one would basically write: jq .data

arangoexport does allow one to specify multiple collections in a single invocation, but they must be specified explicitly.

One possibility for automating the use of arangoexport would be to use arangosh to generate the collection names in a specific database (using db._collections()), and then construct the appropriate arangoexport command or commands.

Upvotes: 2

Related Questions