Class ScanType

java.lang.Object
com.couchbase.client.java.kv.ScanType
Direct Known Subclasses:
PrefixScan, RangeScan, SamplingScan

@Volatile public abstract class ScanType extends Object
Specifies which documents to include in a KV scan.

Create an instance using one of the static factory methods:

  • Constructor Details

    • ScanType

      public ScanType()
  • Method Details

    • rangeScan

      public static RangeScan rangeScan(@Nullable ScanTerm from, @Nullable ScanTerm to)
      Specifies a range scan that includes all documents whose IDs are between two ScanTerms.
      Parameters:
      from - the start of the range, or null for unbounded
      to - the end of the range, or null for unbounded
      Returns:
      a newly created RangeScan to be passed into the Collection API.
    • prefixScan

      public static PrefixScan prefixScan(String documentIdPrefix)
      Specifies a range scan that includes all documents whose IDs start with the given prefix.
      Returns:
      a newly created RangeScan to be passed into the Collection API.
    • samplingScan

      public static SamplingScan samplingScan(long limit)
      Creates a new KV sampling scan, which randomly selects documents up until the configured limit, with a random seed.
      Parameters:
      limit - the number of documents to limit sampling to.
      Returns:
      a newly created RangeScan to be passed into the Collection API.
    • samplingScan

      public static SamplingScan samplingScan(long limit, long seed)
      Creates a new KV sampling scan, which randomly selects documents up until the configured limit, with the specified seed.
      Parameters:
      limit - the number of documents to limit sampling to.
      seed - seed for the random number generator that selects the documents. CAVEAT: Specifying the same seed does not guarantee the same documents are selected.
      Returns:
      a newly created RangeScan to be passed into the Collection API.
    • build

      public abstract CoreScanType build()