orientechnologies/orientdb — pull request #2032 by kowalot (2014-02-09 23:18:15+00:00)
Title: Introducing UPDATE UPSERT

It would be nice to have a functionality similar to PostgreSQL or MongoDB's UPSERT.

UPSERT update a record if it already exists, or insert a new record if it does not - all in a single statement.
It should decreases time of data insertion, where the scenario

if(SELECT record exists) {
UPDATE record;
} else {
INSERT record;
}

is common.
UPSERT operator has a sense with class name and WHERE operator. In other cases generates an exception.

Full UPDATE syntax would look following:
"UPDATE |cluster:> [SET|ADD|PUT|REMOVE|INCREMENT|CONTENT {}|MERGE {}] [[,] = |]* [LOCK ] [UPSERT] [RETURN ] [WHERE ]