getMulti

Gets multiple documents at once, spending a tunable level of effort to minimize read skew.

Parameters

specs

specifies the documents to get.

mode

level of effort to spend on minimizing read skew. The default is intentionally unspecified.

Samples

// Get multiple documents at once, making great effort to avoid read skew.
cluster.transactions.run {
    val spec1 = TransactionDocumentSpec(collection, "someDocumentId")

    // Or use shorthand:
    val spec2 = collection + "anotherDocumentId"

    val result = getMulti(
        specs = listOf(spec1, spec2),
        mode = TransactionGetMultiMode.prioritizeReadSkewDetection(),
    )

    println(result.getOrNull(spec1)?.content)
    println(result.getOrNull(spec2)?.content)
}