Collection

class Collection

Operations that act on a Couchbase collection.

Functions

Link copied to clipboard
fun counter(documentId: String, common: CommonOptions = CommonOptions.Default, durability: Durability = Durability.none(), expiry: Expiry = Expiry.none()): Counter

Returns a counter backed by a document on the server.

Link copied to clipboard
suspend fun exists(id: String, common: CommonOptions = CommonOptions.Default): ExistsResult
Link copied to clipboard
suspend fun get(id: String, common: CommonOptions = CommonOptions.Default, withExpiry: Boolean = false, project: List<String> = emptyList()): GetResult

Gets a document from this collection.

Link copied to clipboard
fun getAllReplicas(id: String, common: CommonOptions = CommonOptions.Default): Flow<GetReplicaResult>
Link copied to clipboard
suspend fun getAndLock(id: String, lockTime: Duration, common: CommonOptions = CommonOptions.Default): GetResult
Link copied to clipboard
suspend fun getAndTouch(id: String, expiry: Expiry, common: CommonOptions = CommonOptions.Default): GetResult
Link copied to clipboard
suspend fun getAnyReplica(id: String, common: CommonOptions = CommonOptions.Default): GetReplicaResult
Link copied to clipboard
suspend fun getAnyReplicaOrNull(id: String, common: CommonOptions = CommonOptions.Default): GetReplicaResult?

Like getAnyReplica, but returns null instead of throwing DocumentUnretrievableException if the document was not found.

Link copied to clipboard
inline suspend fun getOrNull(id: String, common: CommonOptions = CommonOptions.Default, withExpiry: Boolean = false, project: List<String> = emptyList()): GetResult?

Like get, but returns null instead of throwing DocumentNotFoundException if the document is not found.

Link copied to clipboard
inline suspend fun <T> insert(id: String, content: T, common: CommonOptions = CommonOptions.Default, transcoder: Transcoder? = null, durability: Durability = Durability.none(), expiry: Expiry = Expiry.None): MutationResult
Link copied to clipboard
suspend fun lookupIn(id: String, spec: LookupInSpec, common: CommonOptions = CommonOptions.Default, accessDeleted: Boolean = false): LookupInResult
inline suspend fun <T, L : LookupInSpec> lookupIn(id: String, spec: L, common: CommonOptions = CommonOptions.Default, accessDeleted: Boolean = false, block: LookupInResult.() -> T): T

Retrieves specific fields of a document.

Link copied to clipboard
suspend fun mutateIn(id: String, common: CommonOptions = CommonOptions.Default, expiry: Expiry = Expiry.none(), preserveExpiry: Boolean = false, durability: Durability = Durability.none(), storeSemantics: StoreSemantics = StoreSemantics.replace(), serializer: JsonSerializer? = null, accessDeleted: Boolean = false, createAsDeleted: Boolean = false, block: MutateInSpec.() -> Unit): MutateInResult
suspend fun mutateIn(id: String, spec: MutateInSpec, common: CommonOptions = CommonOptions.Default, expiry: Expiry = Expiry.none(), preserveExpiry: Boolean = false, durability: Durability = Durability.none(), storeSemantics: StoreSemantics = StoreSemantics.replace(), serializer: JsonSerializer? = null, accessDeleted: Boolean = false, createAsDeleted: Boolean = false): MutateInResult
Link copied to clipboard
suspend fun remove(id: String, common: CommonOptions = CommonOptions.Default, durability: Durability = Durability.none(), cas: Long = 0): MutationResult
Link copied to clipboard
suspend fun removeOrNull(id: String, common: CommonOptions = CommonOptions.Default, durability: Durability = Durability.none(), cas: Long = 0): MutationResult?

Like remove, but returns null instead of throwing DocumentNotFoundException if the document was not found.

Link copied to clipboard
inline suspend fun <T> replace(id: String, content: T, common: CommonOptions = CommonOptions.Default, transcoder: Transcoder? = null, durability: Durability = Durability.none(), expiry: Expiry = Expiry.None, @SinceCouchbase(value = "7.0") preserveExpiry: Boolean = false, cas: Long = 0): MutationResult
Link copied to clipboard
suspend fun touch(id: String, expiry: Expiry, common: CommonOptions = CommonOptions.Default): MutationResult
Link copied to clipboard
suspend fun unlock(id: String, cas: Long, common: CommonOptions = CommonOptions.Default)
Link copied to clipboard
inline suspend fun <T> upsert(id: String, content: T, common: CommonOptions = CommonOptions.Default, transcoder: Transcoder? = null, durability: Durability = Durability.none(), expiry: Expiry = Expiry.None, @SinceCouchbase(value = "7.0") preserveExpiry: Boolean = false): MutationResult

Updates a document if it exists, otherwise inserts it.

Properties

Link copied to clipboard
val binary: BinaryCollection

Provides access to operations that apply only to binary documents.

Link copied to clipboard
val keyspace: Keyspace
Link copied to clipboard
val name: String
Link copied to clipboard
val scope: Scope