class BucketManager (View source)

Provides management capabilities for the Couchbase Bucket

Methods

array
info()

Returns information about the bucket

flush()

Flushes the bucket (clears all data)

array
listDesignDocuments()

Returns all design documents of the bucket.

array
getDesignDocument(string $name)

Get design document by its name

removeDesignDocument(string $name)

Removes design document by its name

upsertDesignDocument(string $name, array $document)

Creates or replaces design document.

insertDesignDocument(string $name, array $document)

Inserts design document and fails if it is exist already.

array
listN1qlIndexes()

List all N1QL indexes that are registered for the current bucket.

createN1qlPrimaryIndex(string $customName = '', bool $ignoreIfExist = false, bool $defer = false)

Create a primary N1QL index.

createN1qlIndex(string $name, array $fields, string $whereClause = '', bool $ignoreIfExist = false, bool $defer = false)

Create secondary N1QL index.

dropN1qlPrimaryIndex(string $customName = '', bool $ignoreIfNotExist = false)

Drop the given primary index

dropN1qlIndex(string $name, bool $ignoreIfNotExist = false)

Drop the given secondary index

Details

array info()

Returns information about the bucket

Returns an associative array of status information as seen by the cluster for this bucket. The exact structure of the returned data can be seen in the Couchbase Manual by looking at the bucket /info endpoint.

Return Value

array

See also

https://developer.couchbase.com/documentation/server/current/rest-api/rest-bucket-info.html Getting Single Bucket Information

flush()

Flushes the bucket (clears all data)

array listDesignDocuments()

Returns all design documents of the bucket.

Return Value

array

array getDesignDocument(string $name)

Get design document by its name

Parameters

string $name

name of the design document (without _design/ prefix)

Return Value

array

removeDesignDocument(string $name)

Removes design document by its name

Parameters

string $name

name of the design document (without _design/ prefix)

upsertDesignDocument(string $name, array $document)

Creates or replaces design document.

Parameters

string $name

name of the design document (without _design/ prefix)

array $document

insertDesignDocument(string $name, array $document)

Inserts design document and fails if it is exist already.

Parameters

string $name

name of the design document (without _design/ prefix)

array $document

array listN1qlIndexes()

List all N1QL indexes that are registered for the current bucket.

Return Value

array

createN1qlPrimaryIndex(string $customName = '', bool $ignoreIfExist = false, bool $defer = false)

Create a primary N1QL index.

Parameters

string $customName

the custom name for the primary index.

bool $ignoreIfExist

if a primary index already exists, an exception will be thrown unless this is set to true.

bool $defer

true to defer index building.

createN1qlIndex(string $name, array $fields, string $whereClause = '', bool $ignoreIfExist = false, bool $defer = false)

Create secondary N1QL index.

Parameters

string $name

name of the index

array $fields

list of JSON fields to index

string $whereClause

the WHERE clause of the index.

bool $ignoreIfExist

if a secondary index already exists, an exception will be thrown unless this is set to true.

bool $defer

true to defer index building.

dropN1qlPrimaryIndex(string $customName = '', bool $ignoreIfNotExist = false)

Drop the given primary index

Parameters

string $customName

the custom name for the primary index

bool $ignoreIfNotExist

if a primary index does not exist, an exception will be thrown unless this is set to true.

dropN1qlIndex(string $name, bool $ignoreIfNotExist = false)

Drop the given secondary index

Parameters

string $name

the index name

bool $ignoreIfNotExist

if a secondary index does not exist, an exception will be thrown unless this is set to true.