Skip to main content
Deno.AtomicOperation.prototype.commit - Deno documentation
method Deno.AtomicOperation.prototype.commit
AtomicOperation.prototype.commit(): Promise<KvCommitResult | KvCommitError>
Commit the operation to the KV store. Returns a value indicating whether checks passed and mutations were performed. If the operation failed because of a failed check, the return value will be a [`Deno.KvCommitError`](../././~/Deno.KvCommitError) with an `ok: false` property. If the operation failed for any other reason (storage error, invalid value, etc.), an exception will be thrown. If the operation succeeded, the return value will be a [`Deno.KvCommitResult`](../././~/Deno.KvCommitResult) object with a `ok: true` property and the versionstamp of the value committed to KV. If the commit returns `ok: false`, one may create a new atomic operation with updated checks and mutations and attempt to commit it again. See the note on optimistic locking in the documentation for [`Deno.AtomicOperation`](../././~/Deno.AtomicOperation).

Return Type