Skip to main content

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.

Prerequisites

  • You have installed pyseekdb. For more information about how to install pyseekdb, see Quick Start.

  • You are connected to the database. For more information about how to connect to the database, see Client.

Request parameters

client.count_collection()

Request example

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

Database has 1 collections