listCollections - Get the list of collections
The listCollections() method is used to retrieve all collections.
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.
-
If you use seekdb in server mode, make sure seekdb server mode is installed. For more information, see Deploy seekdb with package managers.
-
You are connected to the database. For more information, see SeekdbClient.
-
The collection you want to retrieve exists. If the collection does not exist, an error will be returned.
Request parameters
listCollections()
Request example
import { SeekdbClient } from "seekdb";
// 1. Connect
// Embedded mode - Database management (seekdb Embedded)
// const client = new SeekdbClient({
// path: "./seekdb.db",
// database: "test",
// });
// Remote server mode - Database management (seekdb Server)
const client = new SeekdbClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: "",
database: "test",
});
const collections = await client.listCollections();
Return parameters
| Parameter | Value type | Required | Description | Example value |
|---|---|---|---|---|
name | string | Yes | The name of the queried collection. | my_collection |
dimension | int | No | 384 | |
embeddingFunction | EmbeddingFunction | No | embeddingFunction: DefaultEmbeddingFunction {name: 'default-embed', pipe: null, modelName: 'Xenova/all-MiniLM-L6-v2', revision: undefined, dtype: undefined, cacheDir: undefined, localFilesOnly: undefined, progressCallback: undefined } | |
distance | string | No | cosine | |
metadata | dict | No | Reserved field, no data available |
Return example
[
Collection {
name: 'my_collection',
dimension: 384,
distance: 'cosine',
embeddingFunction: DefaultEmbeddingFunction {
name: 'default-embed',
pipe: null,
modelName: 'Xenova/all-MiniLM-L6-v2',
revision: undefined,
dtype: undefined,
cacheDir: undefined,
localFilesOnly: undefined,
progressCallback: undefined
},
metadata: undefined
}
]