2

In use-cases where it makes sense to store binary data in the database rather than on the filesystem, how should that be done with ArangoDB versions 3.3 or higher? I anticipate using Foxx, but I am open to other alternatives if there are any.

This topic was discussed three years prior but Arango has made signtificant changes to its internal data storage technology since then. In particular, ArangoDB now uses VelocyPack, described here:

GitHub - arangodb/velocypack: A fast and compact format for serialization and storage

VPack is said to "cover all of JSON data types, plus dates, integers, binary data and arbitrary precision numbers."

The previously accepted answer stated, "Storing binary data inside ArangoDB has been a long standing feature request. Currently its not possible out of the box."

If I understand VPack correctly, it seems that answer is now incorrect. Hence the presumed need for a new question.

After reading about File access in Foxx in the ArangoDB manual here, coupled with reading about VPack and not having any experience with these things, I'm not sure what approach to take.

An alternative is to store images on the filesystem as described here:

Handling Binary Data in Foxx 3.0 - J@ArangoDB

However, as the ArangoDB manual states,

ArangoDB is primarily a database. In most cases the best place to store data is therefore inside the database, not on the file system.

BugBuddy
  • 576
  • 2
  • 5
  • 19

1 Answers1

1

The answer is still correct IMO, because the main transport format is JSON with no direct support for binary data. You find a long discussion on GitHub.

You should also take into account that both storage engines work after the append-only principle. Any mutation to a document creates a new document revision, which means that most of the data has to be copied. If you store a huge blob of a data in a document, an update to any attribute will take longer to save compared to small documents.

Therefore, you should not store megabytes of data in a single document, but rather reference a file in the file system.

CodeManX
  • 11,159
  • 5
  • 49
  • 70