Query Guide

Inserting & Updating

Write data using terminal dot-methods on from().

Insert

Insert a new record. Fails with a KeyAlreadyExists error if the key already exists.

from("users").insert("user_102", {name: "Alice", email: "alice@example.com"})

Batch Insert

Insert multiple records atomically. If any key already exists, the entire batch is aborted:

from("users").insert([
["user_103", {name: "Bob"}],
["user_104", {name: "Charlie"}]
])

Upsert

Insert or overwrite a record by key. Unlike insert, upsert does not fail if the key already exists — it overwrites the value.

from("users").upsert("user_102", {name: "Alice", status: "active"})

Batch Upsert

from("inventory").upsert([
["SKU-001", {qty: 150}],
["SKU-002", {qty: 85}]
])

Update

Update specific fields of an existing record. Merges the new fields into the existing value — does not overwrite the entire record.

from("users").update("user_102", {status: "active", lastLogin: now()})

Pipeline Update

Update all records matching a filter pipeline:

from("orders") | filter(status == "pending") .update({status: "processing"})

You can reference existing field values in the update expression:

from("products") | filter(price < 10) .update({price: price * 1.1, updatedAt: now()})