home shape

Updating Documents with an Arangoimp Import

Inspired by the feature request in Github issue #1298, we added update and replace support for ArangoDB’s import facilities.

This extends ArangoDB’s HTTP REST API for importing documents plus the arangoimp binary so they can not only insert new documents but also update existing ones.

Inserts and updates can also be mixed in a single import run. What exactly will happen is configurable by setting arangoimp’s new command-line option --on-duplicate.

By default, error will be reported if a document already exists. This behavior can be changed by setting --on-duplicate to a value of update, replace or ignore. Here is an example result of an import with duplicated keys:

> arangoimp --file data.json --collection users --on-duplicate update

created:          1
warnings/errors:  0
updated/replaced: 2
ignored:          0

So, if you want to aggregate data from several data files, you can try the new import command-line option --on-duplicate.

In a blog post, Jan provides a few usage examples.

Ingo

Ingo Friepoertner

Ingo is dealing with all the good ideas from the ArangoDB community, customers and industry experts to improve the value provided by the company’s native multi-model approach. In former positions he worked as a product owner and tech consultant, building custom software solutions for large companies in various industries. Ingo holds a diploma in business informatics from FHDW University of Applied Sciences.

2 Comments

  1. mu li on August 17, 2016 at 4:08 am

    Hi There,

    I have tried this method, but it doesn’t work for me.
    It raise a error [1488] FATAL Wrong type ‘update’.
    I am using the windows 7 and I have tried 3.0.0 and 3.0.4

    Thanks

    • Wilfried Gösgens on August 23, 2016 at 5:45 pm

      Hi mu,

      this is a bug in 3.0.x, thanks for reporting. It is going to be fixed with the ArangoDB 3.0.6 Release.

Leave a Comment





Get the latest tutorials, blog posts and news: