Skip to main content
Version: V1.1.0

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.

  • You have installed the server mode of seekdb. For more information, see Deploy seekdb by using yum install.

  • 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
const client = new SeekdbClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: "",
database: "test",
});

const collections = await client.listCollections();

Return parameters

ParameterValue typeRequiredDescriptionExample value
namestringYesThe name of the queried collection.my_collection
dimensionintNo384
embeddingFunctionEmbeddingFunctionNoembeddingFunction: DefaultEmbeddingFunction {name: 'default-embed', pipe: null, modelName: 'Xenova/all-MiniLM-L6-v2', revision: undefined, dtype: undefined, cacheDir: undefined, localFilesOnly: undefined, progressCallback: undefined }
distancestringNocosine
metadatadictNoReserved 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
}
]