Skip to content
Oxford Harrison edited this page Nov 15, 2024 · 10 revisions

DOCSLANG


The UPSERT statement.

See APIS ➞ client.query(), table.upsert()

Basic Upsert

// (a): SQL syntax
const result = await client.query(
    `UPSERT INTO public.users
        (name, email)
    VALUES ('Jane', '[email protected]')`
);
// (b): Object-based syntax
const result = await client.database('public').table('users').upsert(
    { name: 'Jane', email: '[email protected]' }
);

Multi-Dimensional Upserts

See also ➞ Magic Paths

Clone this wiki locally