create Scope
suspend fun createScope(scopeName: String, common: CommonOptions = CommonOptions.Default)
Content copied to clipboard
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
scope Name
Name of the scope to create.
Throws
com. couchbase. client. core. error. Scope Exists Exception
if the bucket already has a scope with this name.