EdgeQL Tutorial

Upsert

Subtopics

There are times when rather than an "upsert" you need to select an object or insert it, if it wasn't there. Consider, for example, a feature that would make a post from some placeholder user:

Input
Run
Output
Press the 'Run' button to evaluate the input

Now let's make another post using the same placeholder user (the user id is the same as before):

Input
Run
Output
Press the 'Run' button to evaluate the input

You can verify by looking at the id that no new "Anonymous" user was created, instead the existing one was selected as the author.