Collections
- class acouchbase.management.collections.CollectionManager(impl: AsyncCollectionMgmtInterface)
Performs management operations on a bucket’s scopes and collections.
- async create_collection(collection: CollectionSpec, options: CreateCollectionOptions | None = None, **kwargs: Unpack[CreateCollectionOptionsKwargs]) None
- async create_collection(scope_name: str, collection_name: str, settings: CreateCollectionSettings | None = None, options: CreateCollectionOptions | None = None, **kwargs: Unpack[CreateCollectionOptionsKwargs]) None
Creates a new collection in a specified scope.
Deprecated since version 4.1.9: The overload that takes a
CollectionSpecis deprecated; passscope_nameandcollection_nameinstead.- Parameters:
scope_name (str) – The name of the scope the collection will be created in.
collection_name (str) – The name of the collection to be created
settings (
CreateCollectionSettings, optional) – Settings to apply for the collectionoptions (
CreateCollectionOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
CollectionAlreadyExistsException – If the collection already exists.
ScopeNotFoundException – If the scope does not exist.
- async create_scope(scope_name: str, options: CreateScopeOptions | None = None, **kwargs: Unpack[CreateScopeOptionsKwargs]) None
Creates a new scope.
- Parameters:
scope_name (str) – The name of the scope.
options (
CreateScopeOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
ScopeAlreadyExistsException – If the scope already exists.
- async drop_collection(collection: CollectionSpec, options: DropCollectionOptions | None = None, **kwargs: Unpack[DropCollectionOptionsKwargs]) None
- async drop_collection(scope_name: str, collection_name: str, options: DropCollectionOptions | None = None, **kwargs: Unpack[DropCollectionOptionsKwargs]) None
Drops a collection from a scope.
Deprecated since version 4.1.9: The overload that takes a
CollectionSpecis deprecated; passscope_nameandcollection_nameinstead.- Parameters:
scope_name (str) – The name of the scope the collection is in.
collection_name (str) – The name of the collection to be dropped.
options (
DropCollectionOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
CollectionNotFoundException – If the collection does not exist.
- async drop_scope(scope_name: str, options: DropScopeOptions | None = None, **kwargs: Unpack[DropScopeOptionsKwargs]) None
Drops an existing scope.
- Parameters:
scope_name (str) – The name of the scope.
options (
DropScopeOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
ScopeNotFoundException – If the scope does not exist.
- async get_all_scopes(options: GetAllScopesOptions | None = None, **kwargs: Unpack[GetAllScopesOptionsKwargs]) Iterable[ScopeSpec]
Returns all configured scopes along with their collections.
- Parameters:
options (
GetAllScopesOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Returns:
A list of all configured scopes.
- Return type:
Iterable[
ScopeSpec]
- async update_collection(scope_name: str, collection_name: str, settings: UpdateCollectionSettings, options: UpdateCollectionOptions | None = None, **kwargs: Unpack[UpdateCollectionOptionsKwargs]) None
Updates a collection in a specified scope.
- Parameters:
scope_name (str) – The name of the scope the collection is in.
collection_name (str) – The name of the collection that will be updated
settings (
UpdateCollectionSettings) – Settings to apply for the collectionoptions (
UpdateCollectionOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
CollectionNotFoundException – If the collection does not exist.
ScopeNotFoundException – If the scope does not exist.
This module also publishes these, described where they are first documented: