Documentation Index
Fetch the complete documentation index at: https://docs.larksh.com/llms.txt
Use this file to discover all available pages before exploring further.
Writing data
The Lark SDK gives you several ways to write data. All write operations are optimistic: your local state updates immediately, and the write is sent to the server in the background. If the server rejects it (due to security rules, for example), the local state rolls back.set(value)
Overwrites the data at a reference. Any existing data at that location, including all children, is replaced.
update(values)
Performs a shallow merge at the reference location. Only the specified keys are written. Other existing keys are left untouched.
Multi-path updates
You can update multiple locations atomically by callingupdate() on a parent reference with full paths as keys:
remove()
Deletes data at a reference. Equivalent to set(null).
push(value)
Generates a unique key and writes the value under it. Returns a reference to the new child location.
push() without a value to just generate the key:
setWithPriority(value, priority)
Sets data along with a priority value. Priorities affect the default sort order when querying.
setPriority(priority)
Updates only the priority of an existing node without changing its value.
Server values
The SDK provides special server-side values throughServerValue.
ServerValue.TIMESTAMP
Resolves to the server’s current timestamp (milliseconds since epoch) when the write is processed.
ServerValue.TIMESTAMP is evaluated on the server, so it reflects the server’s clock, not the client’s. This is important for consistency across clients in different time zones or with inaccurate local clocks.Write guarantees
All writes return a promise. The promise resolves when the server has acknowledged the write. If the write is rejected (e.g., by security rules), the promise rejects with aLarkError.

