countCollection - Count the number of collections
The countCollection() method is used to count the number of collections in the database.
info
This API can only be used when connected with SeekdbClient. For more information about SeekdbClient, see SeekdbClient.
Prerequisites
-
You have installed seekdb-js. For more information, see Quick start.
-
You have installed the server mode of seekdb. For more information, see Deploy SEEK_DB_PLACEHOLDER_ab18301ff7254b488dbdea45f814224c by using yum install.
-
You are connected to the database. For more information, see SeekdbClient.
-
The collection you want to count exists. If the collection does not exist, an error will be returned.
Request parameters
countCollection()
Request example
import { SeekdbClient } from "seekdb";
// 1. Connect
const client = new SeekdbClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: "",
database: "test",
});
const count = await client.countCollection();
console.log(count);
Response parameters
None
Response example
2