Lookup In Spec
Specifies which fields to retrieve when doing a subdoc lookup.
Samples
import com.couchbase.client.kotlin.Collection
import com.couchbase.client.kotlin.kv.LookupInSpec
fun main() {
//sampleStart
// Subdoc lookup
val spec = object : LookupInSpec() {
val sku = get("sku")
val hasPrice = exists("price")
val orderCount = count("orders")
}
collection.lookupIn(documentId, spec) {
println("cas: $cas")
with(spec) {
println("sku: ${sku.contentAs<String>()}")
println("has price: ${hasPrice.value}")
println("order count: ${orderCount.value}")
}
}
//sampleEnd
}