ArangoDB 3.12 Product Release Announcement! Read the blog for details. Read Blog

Vector-5

Preview of the UPSERT Command

Estimated reading time: 1 minutes

This week saw the completion of the AQL UPSERT command. This command will be very helpful in a lot of use cases, including the following:

  • ensure that a document exists
  • update a document if it exists, otherwise create it
  • replace a document if it exists, otherwise create it

The UPSERT command is executed on the server side and so delivers client applications from issuing a fetch command followed by a separate, conditional UPDATE or INSERT command.

The general format of an UPSERT statement is:

UPSERT search-document
INSERT insert-expression
UPDATE update-expression
IN collection-name

Jan collected a few example invocations of UPSERT in his blog.

Picture of Ingo Friepoertner
March 27, 2015 ,

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.

Leave a Comment