BUCKET.CLOSE
Closes a cursor and releases its associated query context from the session.
Syntax
Section titled “Syntax”BUCKET.CLOSE <operation> <cursor-id>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
operation | string | Yes | The operation type. Must be QUERY, DELETE, or UPDATE. |
cursor-id | integer | Yes | The cursor ID returned by the initial command (BUCKET., BUCKET., or BUCKET.). |
Return Value
Section titled “Return Value”Returns OK on success.
Errors
Section titled “Errors”| Error Code | Description |
|---|---|
ERR | no cursor found if the cursor does not exist or was already closed. |
ERR | Unknown '<operation>' action if the operation type is not QUERY, DELETE, or UPDATE. |
Examples
Section titled “Examples”Close a query cursor:
> BUCKET.QUERY users '{}' LIMIT 100cursor_id -> (integer) 1entries -> [...] (first 100 documents)
> BUCKET.CLOSE QUERY 1OKDouble-close returns an error:
> BUCKET.QUERY users '{}' LIMIT 100cursor_id -> (integer) 1entries -> [...]
> BUCKET.CLOSE QUERY 1OK
> BUCKET.CLOSE QUERY 1(error) ERR no cursor foundClose after pagination:
> BUCKET.DELETE users '{"status": "inactive"}' LIMIT 50cursor_id -> (integer) 1object_ids -> [...] (first 50 deleted)
> BUCKET.ADVANCE DELETE 1cursor_id -> (integer) 1object_ids -> [...] (next 50 deleted)
> BUCKET.CLOSE DELETE 1OKClosing one cursor does not affect others:
> BUCKET.QUERY users '{}' LIMIT 10cursor_id -> (integer) 1entries -> [...]
> BUCKET.DELETE users '{"status": "inactive"}' LIMIT 10cursor_id -> (integer) 2object_ids -> [...]
> BUCKET.CLOSE QUERY 1OK
> BUCKET.ADVANCE DELETE 2cursor_id -> (integer) 2object_ids -> [...] (still works)