arangoimport 中的 --define 选项如何使用?

How is the option --define used in arangoimport?

documentation中,我不清楚如何使用这个选项吗?

是否用于告诉 arangoimport : "Hey, please use this field as _from/_to field when you import" ?

define string… Define key=value for a @key@ entry in config file

这与数据导入无关。 arangodarangosh等都支持--define设置环境变量,可以在配置文件中使用@FOO@等占位符,像--define FOO=something一样设置命令行。

此处简要说明:https://www.arangodb.com/docs/stable/administration-configuration.html#environment-variables-as-parameters

示例配置文件example.conf:

[server]
endpoint = tcp://127.0.0.1:@PORT@

调用示例:

arangosh --config example.conf --define PORT=8529

对于带分隔符的源文件(CSV、TSV),您可以使用选项 --translate 将列映射到不同的属性,例如--translate "child=_from" --translate "parent=_to".

https://www.arangodb.com/docs/stable/programs-arangoimport-examples-csv.html#attribute-name-translation

如果引用只是键,那么您可以使用 --from-collection-prefixto-collection-prefix 作为集合名称的前缀。

--translate 不支持 JSON 输入。您可以使用驱动程序进行翻译和导入,或者以某种方式编辑源文件,或者导入到集合中,然后使用 AQL 调整字段。