Results

AnalyticsResult

class couchbase.result.AnalyticsResult
rows()

The rows which have been returned by the analytics query.

Note

If using the acouchbase API be sure to use async for when looping over rows.

Returns:

Either an iterable or async iterable.

Return type:

Iterable

metadata()

The meta-data which has been returned by the analytics query.

Returns:

An instance of AnalyticsMetaData.

Return type:

AnalyticsMetaData

ClusterInfoResult

class couchbase.result.ClusterInfoResult
property is_community: bool | None

True if connected Couchbase Server is Community edition, false otherwise.

Type:

bool

property is_enterprise: bool | None

True if connected Couchbase Server is Enterprise edition, false otherwise.

Type:

bool

property server_version: str | None
property server_version_full: str | None

The full version details of the connected Couchbase Server.

Type:

Optional[str]

property server_version_short: float | None

The version of the connected Couchbase Server in Major.Minor form.

Type:

Optional[float]

CounterResult

class couchbase.result.CounterResult
property cas: int

Warning

This property is deprecated and will be removed in a future version.

int: DEPRECATED The CAS of the document.

property content: int | None

The value of the document after the operation completed.

Type:

Optional[int]

property key: str | None

Key for the operation, if it exists.

Type:

Optional[str]

DiagnosticsResult

class couchbase.result.DiagnosticsResult
property id: str

The unique identifier for this report.

Type:

str

property endpoints: Dict[str, Any]

A map of service endpoints and their diagnostic status.

Type:

Dict[str, Any]

property state: ClusterState

The cluster state.

Type:

ClusterState

property sdk: str

The name of the SDK which generated this report.

Type:

str

property version: int

The version number of this report.

Type:

int

as_json() str

Returns a JSON formatted diagnostics report.

Returns:

JSON formatted diagnostics report.

Return type:

str

ExistsResult

class couchbase.result.ExistsResult
property exists: bool

True if the document exists, false otherwise.

Type:

bool

GetResult

class couchbase.result.GetResult
property cas: int | None

The CAS of the document, if it exists

Type:

Optional[int]

property content_as: Any

The contents of the document.

Get the value as a dict:

res = collection.get(key)
value = res.content_as[dict]
Type:

Any

property key: str | None

Key for the operation, if it exists.

Type:

Optional[str]

property expiry_time: datetime | None

The expiry of the document, if it was requested.

Type:

Optional[datetime]

LookupInResult

class couchbase.result.LookupInResult
property cas: int | None

The CAS of the document, if it exists

Type:

Optional[int]

property content_as: ContentSubdocProxy

A proxy to return the value at the specified index.

Get first value as a dict:

res = collection.lookup_in(key, (SD.get("geo"), SD.exists("city")))
value = res.content_as[dict](0)
Type:

ContentSubdocProxy

MultiCounterResult

class couchbase.result.MultiCounterResult
property all_ok: bool

True if all operations succeeded, false otherwise.

Type:

bool

property exceptions: Dict[str, exception]

Map of keys to their respective exceptions, if the operation had an exception.

Type:

Dict[str, Exception]

property results: Dict[str, CounterResult]

Map of keys to their respective MutationResult, if the operation has a result.

Type:

Dict[str, MutationResult]

MultiGetResult

class couchbase.result.MultiGetResult
property all_ok: bool

True if all operations succeeded, false otherwise.

Type:

bool

property exceptions: Dict[str, exception]

Map of keys to their respective exceptions, if the operation had an exception.

Type:

Dict[str, Exception]

property results: Dict[str, GetResult]

Map of keys to their respective GetResult, if the operation has a result.

Type:

Dict[str, GetResult]

MultiExistsResult

class couchbase.result.MultiExistsResult
property all_ok: bool

True if all operations succeeded, false otherwise.

Type:

bool

property exceptions: Dict[str, exception]

Map of keys to their respective exceptions, if the operation had an exception.

Type:

Dict[str, Exception]

property results: Dict[str, ExistsResult]

Map of keys to their respective MutationResult, if the operation has a result.

Type:

Dict[str, MutationResult]

MultiMutationResult

class couchbase.result.MultiMutationResult
property all_ok: bool

True if all operations succeeded, false otherwise.

Type:

bool

property exceptions: Dict[str, exception]

Map of keys to their respective exceptions, if the operation had an exception.

Type:

Dict[str, Exception]

property results: Dict[str, MutationResult]

Map of keys to their respective MutationResult, if the operation has a result.

Type:

Dict[str, MutationResult]

MutateInResult

class couchbase.result.MutateInResult
property cas: int | None

The CAS of the document, if it exists

Type:

Optional[int]

property content_as: ContentSubdocProxy

A proxy to return the value at the specified index.

Get first value as a str:

res = collection.mutate_in(key, (SD.upsert("city", "New City"),
                                SD.replace("faa", "CTY")))
value = res.content_as[str](0)
Type:

ContentSubdocProxy

MutationResult

class couchbase.result.MutationResult
property cas: int | None

The CAS of the document, if it exists

Type:

Optional[int]

mutation_token() MutationToken | None

Get the operation’s mutation token, if it exists.

Returns:

The operation’s mutation token.

Return type:

Optional[MutationToken]

PingResult

class couchbase.result.PingResult
property id: str

The unique identifier for this report.

Type:

str

property endpoints: Dict[str, Any]

A map of service endpoints and their ping status.

Type:

Dict[str, Any]

property sdk: str

The name of the SDK which generated this report.

Type:

str

property version: int

The version number of this report.

Type:

int

as_json() str

Returns a JSON formatted diagnostics report.

Returns:

JSON formatted diagnostics report.

Return type:

str

QueryResult

class couchbase.result.QueryResult
rows()

The rows which have been returned by the query.

Note

If using the acouchbase API be sure to use async for when looping over rows.

Returns:

Either an iterable or async iterable.

Return type:

Iterable

metadata()

The meta-data which has been returned by the query.

Returns:

An instance of QueryMetaData.

Return type:

QueryMetaData

SearchResult

class couchbase.result.SearchResult
rows()

The rows which have been returned by the search query.

Note

If using the acouchbase API be sure to use async for when looping over rows.

Returns:

Either an iterable or async iterable.

Return type:

Iterable

metadata()

The meta-data which has been returned by the search query.

Returns:

An instance of SearchMetaData.

Return type:

SearchMetaData

ViewResult

class couchbase.result.ViewResult
rows()

The rows which have been returned by the view query.

Note

If using the acouchbase API be sure to use async for when looping over rows.

Returns:

Either an iterable or async iterable.

Return type:

Iterable

metadata()

The meta-data which has been returned by the view query.

Returns:

An instance of ViewMetaData.

Return type:

ViewMetaData

ScanResult

class couchbase.result.ScanResult
property id: str | None

Id for the operation, if it exists.

Type:

Optional[str]

property ids_only: bool

True is KV range scan request options set ids_only to True. False otherwise.

Type:

bool

property cas: int

The CAS of the document, if it exists

Type:

Optional[int]

property content_as: Any

The contents of the document.

Get the value as a dict:

res = collection.get(key)
value = res.content_as[dict]
Raises:

InvalidArgumentException – If called when KV range scan options set without_content to True.

Type:

Any

property expiry_time: datetime | None

The expiry of the document, if it was requested.

Type:

Optional[datetime]

ScanResultIterable

class couchbase.result.ScanResultIterable
rows()

The rows which have been returned by the query.

Note

If using the acouchbase API be sure to use async for when looping over rows.

Returns:

Either an iterable or async iterable.

Return type:

Iterable

cancel_scan()