createScope

suspend fun createScope(scopeName: String, common: CommonOptions = CommonOptions.Default)

Creates a scope in the bucket.

Samples

import com.couchbase.client.kotlin.Bucket
import com.couchbase.client.kotlin.manager.collection.CollectionManager
import com.couchbase.client.kotlin.manager.collection.ScopeSpec
fun main() { 
   //sampleStart 
   // Create a new scope containing some collections
val manager: CollectionManager = bucket.collections

with(manager) {
    val scopeName = "tenant-a"
    createScope(scopeName)
    createCollection(scopeName = scopeName, collectionName = "widgets")
    createCollection(scopeName = scopeName, collectionName = "invoices")

    println(getScope(scopeName))
} 
   //sampleEnd
}

Parameters

scopeName

Name of the scope to create.

Throws

com.couchbase.client.core.error.ScopeExistsException

if the bucket already has a scope with this name.