Range scan

class couchbase.kv_range_scan.PrefixScan(prefix: str)

A scan of every document whose ID starts with a prefix.

Parameters:

prefix (str) – The prefix the IDs share.

property prefix: str

The prefix the IDs share.

class couchbase.kv_range_scan.RangeScan(start: ScanTerm | None = None, end: ScanTerm | None = None)

A scan of every document whose ID falls between two terms.

Parameters:
  • start (ScanTerm, optional) – Where the range starts. Defaults to None, which starts at the lowest ID.

  • end (ScanTerm, optional) – Where the range ends. Defaults to None, which ends at the highest ID.

property end: ScanTerm | None

Where the range ends, or None to end at the highest ID.

property start: ScanTerm | None

Where the range starts, or None to start at the lowest ID.

class couchbase.kv_range_scan.SamplingScan(limit: int, seed: int | None = None)

A scan of a random sample of the collection’s documents.

Parameters:
  • limit (int) – The most documents the sample holds. Must be greater than 0.

  • seed (int, optional) – The seed the sample is drawn with. The same seed draws the same sample from the same data. Defaults to None, which draws a different sample each time.

property limit: int

The most documents the sample holds.

property seed: int | None

The seed the sample is drawn with, or None to draw a different sample each time.

class couchbase.kv_range_scan.ScanTerm(term: str, exclusive: bool | None = None)

One end of a RangeScan.

Parameters:
  • term (str) – The document ID the range starts or ends at.

  • exclusive (bool, optional) – True to leave the term itself out of the range. Defaults to None, which includes it.

Raises:

InvalidArgumentException – If the term is not a str.

class couchbase.kv_range_scan.ScanType

The kind of scan scan() runs.

Pass one of RangeScan, PrefixScan or SamplingScan.