Collection

class Collection

Operations that act on a Couchbase collection.

Functions

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

Returns a counter backed by a document on the server.

exists
Link copied to clipboard
suspend fun exists(id: String, common: CommonOptions = CommonOptions.Default): ExistsResult
get
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.

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

getOrNull
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.

insert
Link copied to clipboard
inline suspend fun <T> insert(id: String, content: T, common: CommonOptions = CommonOptions.Default, transcoder: Transcoder? = null, durability: Durability = Durability.disabled(), expiry: Expiry = Expiry.None): MutationResult
lookupIn
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.

mutateIn
Link copied to clipboard
suspend fun mutateIn(id: String, common: CommonOptions = CommonOptions.Default, expiry: Expiry = Expiry.none(), preserveExpiry: Boolean = false, durability: Durability = Durability.disabled(), 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.disabled(), storeSemantics: StoreSemantics = StoreSemantics.replace(), serializer: JsonSerializer? = null, accessDeleted: Boolean = false, createAsDeleted: Boolean = false): MutateInResult
remove
Link copied to clipboard
suspend fun remove(id: String, common: CommonOptions = CommonOptions.Default, durability: Durability = Durability.disabled(), cas: Long = 0): MutationResult
replace
Link copied to clipboard
inline suspend fun <T> replace(id: String, content: T, common: CommonOptions = CommonOptions.Default, transcoder: Transcoder? = null, durability: Durability = Durability.disabled(), expiry: Expiry = Expiry.None, preserveExpiry: Boolean = false, cas: Long = 0): MutationResult
touch
Link copied to clipboard
suspend fun touch(id: String, expiry: Expiry, common: CommonOptions = CommonOptions.Default): MutationResult
unlock
Link copied to clipboard
suspend fun unlock(id: String, cas: Long, common: CommonOptions = CommonOptions.Default)
upsert
Link copied to clipboard
inline suspend fun <T> upsert(id: String, content: T, common: CommonOptions = CommonOptions.Default, transcoder: Transcoder? = null, durability: Durability = Durability.disabled(), expiry: Expiry = Expiry.None, preserveExpiry: Boolean = false): MutationResult

Updates a document if it exists, otherwise inserts it.

Properties

binary
Link copied to clipboard
val binary: BinaryCollection

Provides access to operations that apply only to binary documents.

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