---
slug: /count-collection-of-api
---

# count_collection - Count the number of collections

The `count_collection()` method is used to count the number of collections in the database.

:::info

This API is only available when you are connected to the database using a Client. For more information about the Client, see [Client](../50.client.md).

:::

## Prerequisites

* You have installed pyseekdb. For more information about how to install pyseekdb, see [Quick Start](../../10.pyseekdb-sdk/10.pyseekdb-sdk-get-started.md).

* You are connected to the database. For more information about how to connect to the database, see [Client](../50.client.md).

## Request parameters

```python
client.count_collection()
```

## Request example

```python
import pyseekdb

# Create a client
client = pyseekdb.Client()

# Count collections in database
collection_count = client.count_collection()
print(f"Database has {collection_count} collections")
```

## Return parameters

None

## Return example

```pyhton
Database has 1 collections
```

## Related operations

* [Create a collection](100.create-collection-of-api.md)
* [Query a collection](200.get-collection-of-api.md)
* [Create or query a collection](250.get-or-create-collection-of-api.md)
* [Get a collection list](300.list-collection-of-api.md)
* [Delete a collection](400.delete-collection-of-api.md)
