ANN: Couchbase Kotlin SDK 1.0.0 GA

We :heart: Kotlin, and we think you will too :slight_smile:

We are pleased to announce the 1.0.0 GA release of the Couchbase Kotlin SDK.

The Couchbase Kotlin SDK runs on the JVM. It’s built on top of the same high performance I/O core as the Couchbase Java SDK. It provides idiomatic Kotlin features like default arguments, suspend functions, and tasteful DSLs.

Everything not annotated as “uncommitted” or “volatile” is now part of the stable public API.

A huge Thank You! goes out to everyone who provided feedback during the developer preview phase.

Documentation | API Reference | Code Samples | Source Code

Maven coordinates


Changes since 1.0.0-dp.7


  • KCBC-69 The Capella Certificate Authority (CA) certificate is now bundled with the SDK, so you don’t need to configure a trust source when connecting to Capella. (The bundled Capella CA certificate is only trusted if you don’t specify an alternate trust source.)

  • KCBC-64 Added Cluster.users for managing Couchbase users.

  • KCBC-63 Added Cluster.buckets for managing buckets.

  • KCBC-26 Added Cluster.queryIndexes for managing N1QL query indexes.

  • KCBC-66 Added schedulerThreadCount client setting for tuning the number of scheduler threads without having to supply your own scheduler.

Breaking changes

  • KCBC-76 SearchSort.byScore() order now defaults to descending instead of ascending.

  • KCBC-74 GetResult.expiry is now non-null. An unknown expiry is now represented as Expiry.Unknown.

  • KCBC-73 Removed scope.defaultCollection(), because only the default scope has a default collection. If you were calling this method, you can replace it with scope.collection("_default").

  • KCBC-70 Minimum supported Kotlin version is 1.6.20.


@david.nault this is awesome! Congrats on the release. Are there any code examples that show off using coroutines with flows? I looked through the Code Samples link you posted and I couldn’t find any.


1 Like

Hi Aaron,

You’re right, the query code samples don’t work directly with flows. Instead they use the Flow<QueryFlowItem>.execute() extension function to collect the flow.

Depending on which overload you use, execute() either buffers the rows into a list, or invokes a lambda on each row as it arrives from the server. The lambda runs in the coroutine context of the method that called execute.

// Streaming query, for when result size is large or unbounded
val metadata: QueryMetadata = cluster
    .query("select * from `travel-sample`") // returns Flow<QueryFlowItem>
    .execute { row -> println(row) } // collects flow, passes each row to lambda

If you’d prefer to work directly with the flow, you can skip the call to execute.


1 Like

This is VERY cool!