首页 > 解决方案 > 如何使用_id将json文件导入/上传到arangoDB?

问题描述

我想导入我的 json 文件来创建一个集合。从我在下面尝试过的文档中,

arangoimp --file nodes.json --collection nodes --create-collection true

nodes.json我的本地文件在哪里,nodes是我的收藏。我可以毫无困难地成功完成这个过程。但它 arangoDB 自己创建它_id。我想跳过这个过程。即,我想为_id我的文档指定值。这个怎么做?

我尝试使用名称创建另一个字段_id。但它没有创造任何东西(我认为_id是保留字)。如何通过指定上传文件_idarangoimp

标签: arangodb

解决方案


The _id is a combination of the collection name and _key and will be generated during import.

Use _key in your json / json lines import file instead:

{ "_key": "IDDQD", "value": "James"}
{ "_key": "IDBEHOLDI", "value": 42}

Complete documentation, also how to specify an already existing ID as _key (CSV import) could be found in the arangoimp documentation.


推荐阅读