如何使用 VelocyPack (VPack) 在 ArangoDB 中存储图像?
How to store images in ArangoDB with VelocyPack (VPack)?
在将二进制数据存储在数据库而不是文件系统中有意义的用例中,ArangoDB 3.3 或更高版本应该如何完成?我预计会使用 Foxx,但如果有其他选择,我愿意接受。
该主题是 ,但 Arango 从那时起对其内部数据存储技术进行了重大更改。特别是,ArangoDB 现在使用 VelocyPack,描述如下:
GitHub - arangodb/velocypack: A fast and compact format for serialization and storage
据说VPack "cover all of JSON data types, plus dates, integers, binary data and arbitrary precision numbers."
先前接受的答案指出,"Storing binary data inside ArangoDB has been a long standing feature request. Currently its not possible out of the box."
如果我对 VPack 的理解是正确的,看来 现在的答案是不正确的。因此,假定需要一个新问题。
在阅读了 ArangoDB 手册中关于 Foxx 中的文件访问的内容后 here,再加上阅读了 VPack 并且对这些事情没有任何经验,我不确定该采取什么方法。
另一种方法是按照此处所述将图像存储在文件系统上:
Handling Binary Data in Foxx 3.0 - J@ArangoDB
但是,正如 ArangoDB 手册所述,
ArangoDB is primarily a database. In most cases the best place to store data is therefore inside the database, not on the file system.
IMO 的答案仍然正确,因为主要传输格式是 JSON,不直接支持二进制数据。您在 GitHub.
上找到了很长的讨论
您还应该考虑到两个存储引擎都遵循仅追加原则。对文档的任何更改都会创建一个新的文档修订版,这意味着必须复制大部分数据。如果您在文档中存储大量数据,与小文档相比,对任何属性的更新都需要更长的时间来保存。
因此,您不应在单个文档中存储兆字节的数据,而应引用文件系统中的文件。
在将二进制数据存储在数据库而不是文件系统中有意义的用例中,ArangoDB 3.3 或更高版本应该如何完成?我预计会使用 Foxx,但如果有其他选择,我愿意接受。
该主题是
GitHub - arangodb/velocypack: A fast and compact format for serialization and storage
据说VPack "cover all of JSON data types, plus dates, integers, binary data and arbitrary precision numbers."
先前接受的答案指出,"Storing binary data inside ArangoDB has been a long standing feature request. Currently its not possible out of the box."
如果我对 VPack 的理解是正确的,看来 现在的答案是不正确的。因此,假定需要一个新问题。
在阅读了 ArangoDB 手册中关于 Foxx 中的文件访问的内容后 here,再加上阅读了 VPack 并且对这些事情没有任何经验,我不确定该采取什么方法。
另一种方法是按照此处所述将图像存储在文件系统上:
Handling Binary Data in Foxx 3.0 - J@ArangoDB
但是,正如 ArangoDB 手册所述,
ArangoDB is primarily a database. In most cases the best place to store data is therefore inside the database, not on the file system.
IMO 的答案仍然正确,因为主要传输格式是 JSON,不直接支持二进制数据。您在 GitHub.
上找到了很长的讨论您还应该考虑到两个存储引擎都遵循仅追加原则。对文档的任何更改都会创建一个新的文档修订版,这意味着必须复制大部分数据。如果您在文档中存储大量数据,与小文档相比,对任何属性的更新都需要更长的时间来保存。
因此,您不应在单个文档中存储兆字节的数据,而应引用文件系统中的文件。